Compare commits
3 Commits
ad01912232
...
chuvok-fix
| Author | SHA1 | Date | |
|---|---|---|---|
| df7ebd6973 | |||
|
|
11589d4623 | ||
|
|
d3161b22bf |
9
tim.h
9
tim.h
@@ -765,7 +765,6 @@ static void init_terminal(void) {
|
||||
SetConsoleCP(CP_UTF8); // set utf8 in/out code page
|
||||
SetConsoleOutputCP(CP_UTF8); //
|
||||
write_str(S("\33[?1049h")); // use alternate buffer
|
||||
write_str(S("\33[?25l")); // disable cursor
|
||||
update_screen_size(); //
|
||||
}
|
||||
|
||||
@@ -804,8 +803,10 @@ static void read_event(int timeout_ms) {
|
||||
|
||||
while (true) {
|
||||
memset(e, 0, sizeof(*e));
|
||||
DWORD r = WaitForSingleObject(h, timeout_ms);
|
||||
// In cmd.exe the cursor somtimes reappears. This reliably hides it.
|
||||
write_str(S("\33[?25l"));
|
||||
|
||||
DWORD r = WaitForSingleObject(h, timeout_ms);
|
||||
if (r == WAIT_TIMEOUT) {
|
||||
e->type = DRAW_EVENT;
|
||||
update_screen_size(); // workaround, see WINDOW_BUFFER_SIZE_EVENT
|
||||
@@ -817,7 +818,7 @@ static void read_event(int timeout_ms) {
|
||||
// received input
|
||||
INPUT_RECORD rec = {0};
|
||||
DWORD n = 0;
|
||||
ReadConsoleInput(h, &rec, 1, &n);
|
||||
ReadConsoleInputW(h, &rec, 1, &n);
|
||||
|
||||
switch (rec.EventType) {
|
||||
case KEY_EVENT: {
|
||||
@@ -866,8 +867,6 @@ static void read_event(int timeout_ms) {
|
||||
// terminal width changes and not for the height. As a workaround
|
||||
// the screen size is updated every time an event is emitted.
|
||||
update_screen_size();
|
||||
// For cmd.exe the cursor has to be hidden after each resize event.
|
||||
write_str(S("\33[?25l"));
|
||||
return;
|
||||
}
|
||||
} // while
|
||||
|
||||
Reference in New Issue
Block a user