Browse Source

* fix for wrong behaviour of SetSafeCPSwitching

git-svn-id: trunk@37709 -
Tomas Hajny 7 years ago
parent
commit
f4b0a46620
1 changed files with 5 additions and 4 deletions
  1. 5 4
      packages/rtl-console/src/win/crt.pp

+ 5 - 4
packages/rtl-console/src/win/crt.pp

@@ -122,13 +122,14 @@ end;
 procedure SetUseACP(ACP:Boolean);
 procedure SetUseACP(ACP:Boolean);
 begin
 begin
     UseACP:=ACP;
     UseACP:=ACP;
-    if UseACP then
-      if not(SafeCPSwitching) then
+    if not(SafeCPSwitching) then
+     begin
+      if UseACP then
         SetConsoleOutputCP(GetACP)   // Set console CP only once here if SafeCPSwitching is False and
         SetConsoleOutputCP(GetACP)   // Set console CP only once here if SafeCPSwitching is False and
                                      // if UseACP is True
                                      // if UseACP is True
       else
       else
-       SetConsoleOutputCP(OriginalConsoleOutputCP)    // Set console back to original if UseACP is False
-    else
+        SetConsoleOutputCP(OriginalConsoleOutputCP)    // Set console back to original if UseACP is False
+     end;
 end;
 end;
 
 
 procedure TextMode (Mode: word);
 procedure TextMode (Mode: word);