mc/lib/tty
Denys Vlasenko ecd3b62b8e This change prevents misinterpreting an unknown ESC sequence's
tail as a garbage input. To reproduce, run "sleep 3" and
hold down Down_Arrow key until sleep runs.
With debugging log enabled, the following can be seen:

entered get_key_code(no_delay:0)
 c=tty_lowlevel_getch()=27
 push_char(27) !0
 c=xgetch_second()=91
 push_char(91) !0
 2 c=tty_lowlevel_getch()=66
 push_char(66)
 seq_buffer[0]:27   <---- the saved Down Arrow sequence "ESC [ B"
 seq_buffer[1]:91
 seq_buffer[2]:66
 seq_buffer[3]:0
pending_keys!=NULL. m=-1
d=*pending_keys++=27
d=ALT(*pending_keys++)=ALT(91)=8283
^^^^^^^^^^^^^^^^^^^^^^^ we misinterpret "ESC [ B" as "ESC ["
return correct_key_code(8283)
entered get_key_code(no_delay:0)
pending_keys!=NULL. m=-1
d=*pending_keys++=66
^^^^^^^^^^^^ we think user pressed "B"
return correct_key_code(66)

With this patch, no bogus "input" is generated.

Longer unknown sequences need an additional fix, coming next.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
2013-05-23 11:42:02 +03:00
..
color-internal.c Ticket 1551: Update GPL version from 2 to 3 2011-10-18 14:08:34 +03:00
color-internal.h Ticket #2169: Add support for 256 colors terminals 2010-12-29 11:58:10 +02:00
color-ncurses.c Ticket 1551: Update GPL version from 2 to 3 2011-10-18 14:08:34 +03:00
color-slang.c Ticket 1551: Update GPL version from 2 to 3 2011-10-18 14:08:34 +03:00
color-slang.h Ticket #2169: Add support for 256 colors terminals 2010-12-29 11:58:10 +02:00
color.c lib/tty/color.c: use unsigned type for conversion between integer and pointer. 2012-12-20 15:18:06 +04:00
color.h Code indentation. 2012-07-17 17:04:05 +04:00
key.c This change prevents misinterpreting an unknown ESC sequence's 2013-05-23 11:42:02 +03:00
key.h Ticket #2662: support extended mouse clicks beyond 223. 2011-11-29 09:50:03 +03:00
keyxdef.c Ticket 1551: Update GPL version from 2 to 3 2011-10-18 14:08:34 +03:00
Makefile.am Clarify usage of AM_CPPFLAGS. 2012-12-18 16:27:49 +04:00
mouse.c Ticket #2956: Newer protocol for extended mouse clicks. 2013-02-13 14:18:57 +03:00
mouse.h Ticket #2956: Newer protocol for extended mouse clicks. 2013-02-13 14:18:57 +03:00
tty-internal.h (tty_lowlevel_getch): used in lib/tty only. 2011-12-12 12:23:25 +03:00
tty-ncurses.c Ticket #2964: mouse doesn't select text in subshell in native console. 2013-02-14 14:26:25 +04:00
tty-ncurses.h Code indentation in lib directory 2010-11-24 10:27:20 +03:00
tty-slang.c Ticket #2964: mouse doesn't select text in subshell in native console. 2013-02-14 14:26:25 +04:00
tty-slang.h Code indentation in lib directory 2010-11-24 10:27:20 +03:00
tty.c Ticket #2956: Newer protocol for extended mouse clicks. 2013-02-13 14:18:57 +03:00
tty.h (tty_lowlevel_getch): used in lib/tty only. 2011-12-12 12:23:25 +03:00
win.c Refactoring of endless loops and some type accuracy. 2012-10-21 18:19:52 +04:00
win.h Moved xterm_flag global variable to mc_global.tty.xterm_flag 2011-09-08 14:12:10 +04:00
x11conn.c Tweak sources for --with-x/--without-x option. 2012-11-09 10:05:13 +04:00
x11conn.h Code indentation in lib directory 2010-11-24 10:27:20 +03:00