mirror of
https://github.com/mpv-player/mpv
synced 2025-01-01 12:22:22 +00:00
getch2: Only send ESC if it was typed twice
Avoids quitting mpv if any unknown escape is entered.
This commit is contained in:
parent
3928b39988
commit
15742504d0
@ -405,9 +405,11 @@ bool getch2(struct input_ctx *input_ctx)
|
||||
} else if (utf8_len == 1) {
|
||||
switch (c) {
|
||||
case 0x1b: /* ESC that's not part of escape sequence */
|
||||
mp_input_put_key(input_ctx, MP_KEY_ESC);
|
||||
if (getch2_len > 1 && getch2_buf[1] == 0x1b)
|
||||
walk_buf(1); /* eat the second ESC if it was typed twice */
|
||||
/* only if ESC was typed twice, otherwise ignore it */
|
||||
if (getch2_len > 1 && getch2_buf[1] == 0x1b) {
|
||||
walk_buf(1); /* eat the second ESC */
|
||||
mp_input_put_key(input_ctx, MP_KEY_ESC);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
mp_input_put_key(input_ctx, c);
|
||||
|
Loading…
Reference in New Issue
Block a user