diff --git a/src/fsharp/fsi/console.fs b/src/fsharp/fsi/console.fs index 1ce4d942be3..54bcec08512 100644 --- a/src/fsharp/fsi/console.fs +++ b/src/fsharp/fsi/console.fs @@ -131,7 +131,7 @@ module Utils = type Cursor = static member ResetTo(top,left) = Utils.guard(fun () -> - Console.CursorTop <- top; + Console.CursorTop <- min top (Console.BufferHeight - 1); Console.CursorLeft <- left) static member Move(inset, delta) = let position = Console.CursorTop * (Console.BufferWidth - inset) + (Console.CursorLeft - inset) + delta @@ -216,6 +216,7 @@ type ReadLineConsole() = if currLeft < x.Inset then if currLeft = 0 then Console.Write (if prompt then x.Prompt2 else String(' ',x.Inset)) Utils.guard(fun () -> + Console.CursorTop <- min Console.CursorTop (Console.BufferHeight - 1); Console.CursorLeft <- x.Inset); // The caller writes the primary prompt. If we are reading the 2nd and subsequent lines of the