diff options
author | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2013-07-26 11:30:10 -0300 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2013-07-26 11:30:10 -0300 |
commit | 15742504d0065899106a5a888501fe54d8970d99 (patch) | |
tree | f01179a124fc60fee6834c0f748e5f823d2b6ed7 /osdep | |
parent | 3928b39988155c5e1a20685335d47fb9b681eb00 (diff) | |
download | mpv-15742504d0065899106a5a888501fe54d8970d99.tar.bz2 mpv-15742504d0065899106a5a888501fe54d8970d99.tar.xz |
getch2: Only send ESC if it was typed twice
Avoids quitting mpv if any unknown escape is entered.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/getch2.c | 8 |
1 files 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); |