Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit 410ca3d

Browse files
Merge pull request #2 from VEIT-Electronics/master
Fixed text clearing in cmd.exe
2 parents de0e3fc + 3d802e7 commit 410ca3d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎LineEditor/getline.cs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
usingSystem.IO;
4545
usingSystem.Threading;
4646
usingSystem.Reflection;
47+
usingSystem.Runtime.InteropServices;
4748

4849
namespaceMono.Terminal{
4950

@@ -409,6 +410,8 @@ public static Handler Alt (char c, ConsoleKey k, KeyHandler h)
409410

410411
staticHandler[]handlers;
411412

413+
privatereadonlyboolisWindows;
414+
412415
/// <summary>
413416
/// Initializes a new instance of the LineEditor, using the specified name for
414417
/// retrieving and storing the history. The history will default to 10 entries.
@@ -467,6 +470,7 @@ public LineEditor (string name, int histsize)
467470

468471
history=newHistory(name,histsize);
469472

473+
isWindows=RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
470474
GetUnixConsoleReset();
471475
//if (File.Exists ("log"))File.Delete ("log");
472476
//log = File.CreateText ("log");
@@ -482,9 +486,7 @@ void GetUnixConsoleReset ()
482486
//
483487
// On Unix, we want to be able to reset the color for the pop-up completion
484488
//
485-
intp=(int)Environment.OSVersion.Platform;
486-
varis_unix=(p==4)||(p==128);
487-
if(!is_unix)
489+
if(isWindows)
488490
return;
489491

490492
// Sole purpose of this call is to initialize the Terminfo driver
@@ -770,8 +772,7 @@ void ShowCompletions (string prefix, string [] completions)
770772
// Ensure we have space, determine window size
771773
intwindow_height=System.Math.Min(completions.Length,Console.WindowHeight/5);
772774
inttarget_line=Console.WindowHeight-window_height-1;
773-
if(Console.CursorTop>target_line){
774-
varsaved_left=Console.CursorLeft;
775+
if(!isWindows&&Console.CursorTop>target_line){
775776
vardelta=Console.CursorTop-target_line;
776777
Console.CursorLeft=0;
777778
Console.CursorTop=Console.WindowHeight-1;

0 commit comments

Comments
 (0)