fix(tui): remove dead code #15929

Before #15889, we used our fork of libuv which supports Windows 7/8.
After #15889, we use upstream libuv, which does not support Windows 7 and lacks
mouse/altbuf support for Windows 8 console.
This commit is contained in:
erw7 2021-10-06 21:13:34 +09:00 committed by GitHub
parent acd5e831b6
commit a161559a00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 54 deletions

View File

@ -46,29 +46,3 @@ void os_replace_stdout_and_stderr_to_conout(void)
const int conerr_fd = _open_osfhandle((intptr_t)conout_handle, 0);
assert(conerr_fd == STDERR_FILENO);
}
void os_set_vtp(bool enable)
{
static TriState is_legacy = kNone;
if (is_legacy == kNone) {
uv_tty_vtermstate_t state;
uv_tty_get_vterm_state(&state);
is_legacy = (state == UV_TTY_UNSUPPORTED) ? kTrue : kFalse;
}
if (!is_legacy && !os_has_vti()) {
uv_tty_set_vterm_state(enable ? UV_TTY_SUPPORTED : UV_TTY_UNSUPPORTED);
}
}
static bool os_has_vti(void)
{
static TriState has_vti = kNone;
if (has_vti == kNone) {
HANDLE handle = (HANDLE)_get_osfhandle(input_global_fd());
DWORD dwMode;
if (handle != INVALID_HANDLE_VALUE && GetConsoleMode(handle, &dwMode)) {
has_vti = !!(dwMode & ENABLE_VIRTUAL_TERMINAL_INPUT) ? kTrue : kFalse;
}
}
return has_vti == kTrue;
}

View File

@ -1019,22 +1019,8 @@ static void tui_mouse_on(UI *ui)
{
TUIData *data = ui->data;
if (!data->mouse_enabled) {
#ifdef WIN32
// Windows versions with vtp(ENABLE_VIRTUAL_TERMINAL_PROCESSING) and
// no vti(ENABLE_VIRTUAL_TERMINAL_INPUT) will need to use mouse tracking of
// libuv. For this reason, vtp (vterm) state of libuv is temporarily
// disabled because the control sequence needs to be processed by libuv
// instead of Windows vtp.
// ref. https://docs.microsoft.com/en-us/windows/console/setconsolemode
flush_buf(ui);
os_set_vtp(false);
#endif
unibi_out_ext(ui, data->unibi_ext.enable_mouse);
data->mouse_enabled = true;
#ifdef WIN32
flush_buf(ui);
os_set_vtp(true);
#endif
}
}
@ -1042,22 +1028,8 @@ static void tui_mouse_off(UI *ui)
{
TUIData *data = ui->data;
if (data->mouse_enabled) {
#ifdef WIN32
// Windows versions with vtp(ENABLE_VIRTUAL_TERMINAL_PROCESSING) and
// no vti(ENABLE_VIRTUAL_TERMINAL_INPUT) will need to use mouse tracking of
// libuv. For this reason, vtp (vterm) state of libuv is temporarily
// disabled because the control sequence needs to be processed by libuv
// instead of Windows vtp.
// ref. https://docs.microsoft.com/en-us/windows/console/setconsolemode
flush_buf(ui);
os_set_vtp(false);
#endif
unibi_out_ext(ui, data->unibi_ext.disable_mouse);
data->mouse_enabled = false;
#ifdef WIN32
flush_buf(ui);
os_set_vtp(true);
#endif
}
}