From 15742504d0065899106a5a888501fe54d8970d99 Mon Sep 17 00:00:00 2001 From: "Diogo Franco (Kovensky)" Date: Fri, 26 Jul 2013 11:30:10 -0300 Subject: getch2: Only send ESC if it was typed twice Avoids quitting mpv if any unknown escape is entered. --- osdep/getch2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osdep/getch2.c b/osdep/getch2.c index f9528f33ea..f02f20e49c 100644 --- a/osdep/getch2.c +++ b/osdep/getch2.c @@ -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); -- cgit v1.2.3