From 612fef47c6ae1a2061c6fbc9c8d0637f278e058e Mon Sep 17 00:00:00 2001 From: Tomas Grosup Date: Fri, 10 Nov 2023 14:12:41 +0100 Subject: [PATCH] Fix linux+macos next line FSI behavior --- src/fsi/console.fs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/fsi/console.fs b/src/fsi/console.fs index 4e68d2aea0b..0bd409d75a1 100644 --- a/src/fsi/console.fs +++ b/src/fsi/console.fs @@ -5,6 +5,7 @@ namespace FSharp.Compiler.Interactive open System open System.Text open System.Collections.Generic +open System.Runtime.InteropServices open FSharp.Compiler.DiagnosticsLogger type internal Style = @@ -242,6 +243,8 @@ type internal Anchor = type internal ReadLineConsole() = let history = new History() + static let supportsBufferHeightChange = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + let mutable complete: (string option * string -> seq) = fun (_s1, _s2) -> Seq.empty @@ -347,7 +350,11 @@ type internal ReadLineConsole() = if Console.CursorLeft + charSize > Utils.bufferWidth () then if Console.CursorTop + 1 = Console.BufferHeight then - Console.BufferHeight <- Console.BufferHeight + 1 + if supportsBufferHeightChange then + Console.BufferHeight <- Console.BufferHeight + 1 + else + Console.WriteLine() + anchor <- { anchor with top = (anchor).top - 1 } Cursor.Move(0)