Skip to content

Commit

Permalink
Fix linux+macos next line FSI behavior (#16251)
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Gro authored Nov 10, 2023
1 parent 9a0b9bf commit d441308
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/fsi/console.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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<string>) =
fun (_s1, _s2) -> Seq.empty

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit d441308

Please sign in to comment.