Skip to content

Commit d441308

Browse files
authored
Fix linux+macos next line FSI behavior (#16251)
1 parent 9a0b9bf commit d441308

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/fsi/console.fs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace FSharp.Compiler.Interactive
55
open System
66
open System.Text
77
open System.Collections.Generic
8+
open System.Runtime.InteropServices
89
open FSharp.Compiler.DiagnosticsLogger
910

1011
type internal Style =
@@ -242,6 +243,8 @@ type internal Anchor =
242243
type internal ReadLineConsole() =
243244
let history = new History()
244245

246+
static let supportsBufferHeightChange = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
247+
245248
let mutable complete: (string option * string -> seq<string>) =
246249
fun (_s1, _s2) -> Seq.empty
247250

@@ -347,7 +350,11 @@ type internal ReadLineConsole() =
347350

348351
if Console.CursorLeft + charSize > Utils.bufferWidth () then
349352
if Console.CursorTop + 1 = Console.BufferHeight then
350-
Console.BufferHeight <- Console.BufferHeight + 1
353+
if supportsBufferHeightChange then
354+
Console.BufferHeight <- Console.BufferHeight + 1
355+
else
356+
Console.WriteLine()
357+
anchor <- { anchor with top = (anchor).top - 1 }
351358

352359
Cursor.Move(0)
353360

0 commit comments

Comments
 (0)