- minor changes for Virtual Terminal Sequences Support in windows 10/11

This commit is contained in:
Roy Qu 2023-09-21 07:19:23 +08:00
parent 52c5ea4caf
commit a2a3ae8a91
2 changed files with 8 additions and 2 deletions

View File

@ -4,6 +4,9 @@ Red Panda C++ Version 2.25
- change: Symbol completion of '{' won't insert extra new lines.
- fix: "move selection up/down" of whole lines selection are no correctly handled.
- enhancement: Improvement of terminal support ( from cyano.CN )
- enhancement: Virtual Terminal Sequences Support in windows 10/11 ( from cyano.CN )
Red Panda C++ Version 2.24

View File

@ -30,6 +30,9 @@ using std::string;
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
#ifndef ENABLE_PROCESSED_OUTPUT
#define ENABLE_PROCESSED_OUTPUT 0x0001
#endif
#define MAX_COMMAND_LENGTH 32768
#define MAX_ERROR_LENGTH 2048
@ -170,11 +173,11 @@ void EnableVtSequence() {
DWORD mode;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
if (GetConsoleMode(hConsole, &mode))
SetConsoleMode(hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
SetConsoleMode(hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);
hConsole = GetStdHandle(STD_ERROR_HANDLE);
if (GetConsoleMode(hConsole, &mode))
SetConsoleMode(hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
SetConsoleMode(hConsole, mode | ENABLE_VIRTUAL_TERMINAL_PROCESSING | ENABLE_PROCESSED_OUTPUT);
}
int main(int argc, char** argv) {