[*] Fix: win32 console - copy/paste scroll bug

This commit is contained in:
Reece Wilson 2022-09-09 21:12:20 +01:00
parent 96e7d5cbcc
commit 7bfa7911cf
3 changed files with 64 additions and 16 deletions

View File

@ -36,6 +36,12 @@ namespace Aurora::Console::ConsoleTTY
gRecordedActions.push_back(std::bind(func, ## __VA_ARGS__)); \
}
void GetConsoleHandles(HANDLE(&handles)[2])
{
handles[0] = gConsoles[0].h;
handles[1] = gConsoles[1].h;
}
AUKN_SYM void SuperSecretTTYReplacer(HANDLE console)
{
gConsole = console;

View File

@ -13,6 +13,8 @@ namespace Aurora::Console::ConsoleTTY
void RecordFunction(const AuFunction<void()> &func);
void GetConsoleHandles(HANDLE(&handles)[2]);
bool WarmBuffering();
void BeginBuffering();
bool EndBuffering();

View File

@ -312,11 +312,7 @@ namespace Aurora::Console::ConsoleTTY
void TTYConsole::UXModeStart()
{
#if defined(AURORA_IS_MODERNNT_DERIVED)
DWORD mode;
HANDLE stream = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(stream, &mode);
mode |= ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(stream, mode);
LeaveScrollMode();
#endif
}
@ -333,11 +329,7 @@ namespace Aurora::Console::ConsoleTTY
}
#if defined(AURORA_IS_MODERNNT_DERIVED)
DWORD mode;
HANDLE stream = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(stream, &mode);
mode &= ~(ENABLE_QUICK_EDIT_MODE);
SetConsoleMode(stream, mode);
EnterScrollMode();
#endif
}
@ -347,9 +339,33 @@ namespace Aurora::Console::ConsoleTTY
#if defined(AURORA_IS_MODERNNT_DERIVED)
DWORD mode;
HANDLE stream = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(stream, &mode);
mode &= ~(ENABLE_QUICK_EDIT_MODE);
SetConsoleMode(stream, mode);
HANDLE handles2[2];
GetConsoleHandles(handles2);
{
GetConsoleMode(stream, &mode);
mode &= ~(ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS);
SetConsoleMode(stream, mode);
}
{
if (handles2[0] != INVALID_HANDLE_VALUE)
{
GetConsoleMode(handles2[0], &mode);
mode &= ~(ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS);
SetConsoleMode(handles2[0], mode);
}
}
{
if (handles2[1] != INVALID_HANDLE_VALUE)
{
GetConsoleMode(handles2[1], &mode);
mode &= ~(ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS);
SetConsoleMode(handles2[1], mode);
}
}
AuStaticCast<TTYConsole>(GetTTYConsole())->uxModeFlipped = true;
#endif
}
@ -359,9 +375,33 @@ namespace Aurora::Console::ConsoleTTY
#if defined(AURORA_IS_MODERNNT_DERIVED)
DWORD mode;
HANDLE stream = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode(stream, &mode);
mode |= ENABLE_QUICK_EDIT_MODE;
SetConsoleMode(stream, mode);
HANDLE handles2[2];
GetConsoleHandles(handles2);
{
GetConsoleMode(stream, &mode);
mode |= ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS;
SetConsoleMode(stream, mode);
}
{
if (handles2[0] != INVALID_HANDLE_VALUE)
{
GetConsoleMode(handles2[0], &mode);
mode |= ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS;
SetConsoleMode(handles2[0], mode);
}
}
{
if (handles2[1] != INVALID_HANDLE_VALUE)
{
GetConsoleMode(handles2[1], &mode);
mode |= ENABLE_QUICK_EDIT_MODE | ENABLE_EXTENDED_FLAGS;
SetConsoleMode(handles2[1], mode);
}
}
AuStaticCast<TTYConsole>(GetTTYConsole())->uxModeFlipped = true; // TODO?
#endif
}