0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

getch2: Only send ESC if it was typed twice

Avoids quitting mpv if any unknown escape is entered.
This commit is contained in:
Diogo Franco (Kovensky) 2013-07-26 11:30:10 -03:00
parent 3928b39988
commit 15742504d0

View File

@ -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);