@@ -46,22 +46,23 @@ public interface Kernel32 extends Library {
4646 }
4747
4848 public static void enableAnsiSupport () {
49- if (Kernel32 .INSTANCE == null ) return ;
50- Pointer stdHandle = Kernel32 .INSTANCE .GetStdHandle (-11 );
51- int [] consoleMode = new int [1 ];
52- if (Kernel32 .INSTANCE .GetConsoleMode (stdHandle , consoleMode ) > 0 ) {
53- int newMode = consoleMode [0 ] | TERMINAL_PROCESSING ;
54- Kernel32 .INSTANCE .SetConsoleMode (stdHandle , newMode );
55- } else {
56- System .out .println ("Failed to set console mode." );
57- }
58- ProcessBuilder pb = new ProcessBuilder ("cmd.exe" , "/c" , "chcp" , "65001" ).inheritIO ();
59- try {
60- Process p = pb .start ();
61- p .waitFor ();
62- } catch (IOException e ) {
63- System .out .println (ConsoleTokens .colorizeText ("&eFailed to change and active page code to 65001.(UTF-8)" ));
64- } catch (InterruptedException ignore ) {
49+ if (Kernel32 .INSTANCE != null ) {
50+ Pointer stdHandle = Kernel32 .INSTANCE .GetStdHandle (-11 );
51+ int [] consoleMode = new int [1 ];
52+ if (Kernel32 .INSTANCE .GetConsoleMode (stdHandle , consoleMode ) > 0 ) {
53+ int newMode = consoleMode [0 ] | TERMINAL_PROCESSING ;
54+ Kernel32 .INSTANCE .SetConsoleMode (stdHandle , newMode );
55+ } else {
56+ System .out .println ("Failed to set console mode." );
57+ }
58+ ProcessBuilder pb = new ProcessBuilder ("cmd.exe" , "/c" , "chcp" , "65001" ).inheritIO ();
59+ try {
60+ Process p = pb .start ();
61+ p .waitFor ();
62+ } catch (IOException e ) {
63+ System .out .println (ConsoleTokens .colorizeText ("&eFailed to change and active page code to 65001.(UTF-8)" ));
64+ } catch (InterruptedException ignore ) {
65+ }
6566 }
6667 try {
6768 winTerminal = TerminalBuilder .builder ()
0 commit comments