|
|
@ -43,6 +43,14 @@ int prepare_windows_terminal(tinfo* ti, size_t* tablelen, size_t* tableused){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ti->caps.rgb = true;
|
|
|
|
ti->caps.rgb = true;
|
|
|
|
ti->caps.colors = 256;
|
|
|
|
ti->caps.colors = 256;
|
|
|
|
|
|
|
|
if(!SetConsoleOutputCP(65001)){
|
|
|
|
|
|
|
|
logerror("couldn't set output page to utf8\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!SetConsoleCP(65001)){
|
|
|
|
|
|
|
|
logerror("couldn't set input page to utf8\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
|
|
|
|
HANDLE in = GetStdHandle(STD_INPUT_HANDLE);
|
|
|
|
if(in == INVALID_HANDLE_VALUE){
|
|
|
|
if(in == INVALID_HANDLE_VALUE){
|
|
|
|
logerror("couldn't get input handle\n");
|
|
|
|
logerror("couldn't get input handle\n");
|
|
|
@ -50,13 +58,29 @@ int prepare_windows_terminal(tinfo* ti, size_t* tablelen, size_t* tableused){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// if we're a true Windows Terminal, SetConsoleMode() ought succeed.
|
|
|
|
// if we're a true Windows Terminal, SetConsoleMode() ought succeed.
|
|
|
|
// otherwise, we're something else; go ahead and query.
|
|
|
|
// otherwise, we're something else; go ahead and query.
|
|
|
|
|
|
|
|
// disable: ENABLE_ECHO_INPUT | ENABLE_INSERT_MODE | ENABLE_LINE_INPUT
|
|
|
|
if(!SetConsoleMode(in, ENABLE_MOUSE_INPUT
|
|
|
|
if(!SetConsoleMode(in, ENABLE_MOUSE_INPUT
|
|
|
|
| ENABLE_VIRTUAL_TERMINAL_INPUT
|
|
|
|
|
|
|
|
| ENABLE_PROCESSED_INPUT
|
|
|
|
| ENABLE_PROCESSED_INPUT
|
|
|
|
| ENABLE_WINDOW_INPUT)){
|
|
|
|
| ENABLE_QUICK_EDIT_MODE
|
|
|
|
|
|
|
|
| ENABLE_EXTENDED_FLAGS
|
|
|
|
|
|
|
|
| ENABLE_WINDOW_INPUT
|
|
|
|
|
|
|
|
| ENABLE_VIRTUAL_TERMINAL_INPUT)){
|
|
|
|
logerror("couldn't set input console mode\n");
|
|
|
|
logerror("couldn't set input console mode\n");
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
|
|
|
|
|
|
if(out == INVALID_HANDLE_VALUE){
|
|
|
|
|
|
|
|
logerror("couldn't get output handle\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!SetConsoleMode(out, ENABLE_PROCESSED_OUTPUT
|
|
|
|
|
|
|
|
| ENABLE_WRAP_AT_EOL_OUTPUT
|
|
|
|
|
|
|
|
| ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
|
|
|
|
|
|
|
| DISABLE_NEWLINE_AUTO_RETURN
|
|
|
|
|
|
|
|
| ENABLE_LVB_GRID_WORLDWIDE)){
|
|
|
|
|
|
|
|
logerror("couldn't set output console mode\n");
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
}
|
|
|
|
ti->caps.quadrants = true;
|
|
|
|
ti->caps.quadrants = true;
|
|
|
|
ti->caps.braille = true;
|
|
|
|
ti->caps.braille = true;
|
|
|
|
ti->termname = "Windows Terminal";
|
|
|
|
ti->termname = "Windows Terminal";
|
|
|
|