Pārlūkot izejas kodu

* better restore console mode for windows

git-svn-id: trunk@6124 -
pierre 18 gadi atpakaļ
vecāks
revīzija
118ee9a8ab
1 mainītis faili ar 7 papildinājumiem un 4 dzēšanām
  1. 7 4
      ide/fpredir.pas

+ 7 - 4
ide/fpredir.pas

@@ -695,9 +695,12 @@ end;
 function ExecuteRedir (Const ProgName, ComLine, RedirStdIn, RedirStdOut, RedirStdErr : String) : boolean;
 {$ifdef Windows}
 var
-  mode : word;
+  mode,modebefore : word;
 {$endif Windows}
 Begin
+{$ifdef Windows}
+  GetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), @modebefore);
+{$endif Windows}
   RedirErrorOut:=0; RedirErrorIn:=0; RedirErrorError:=0;
   ExecuteResult:=0;
   IOStatus:=0;
@@ -715,10 +718,10 @@ Begin
                 (RedirErrorIn=0) and (RedirErrorError=0) and
                 (ExecuteResult=0);
 {$ifdef Windows}
-  // reenable mouse events
+  // restore previous mode
   GetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), @mode);
-  mode:=mode or ENABLE_MOUSE_INPUT;
-  SetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), mode);
+  //mode:=mode or ENABLE_MOUSE_INPUT;
+  SetConsoleMode(GetStdHandle(cardinal(Std_Input_Handle)), modebefore);
 {$endif Windows}
 End;