summaryrefslogtreecommitdiffstats
path: root/old-configure
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-21 22:24:33 +0200
committerwm4 <wm4@nowhere>2014-08-21 22:45:58 +0200
commit4b5c3ea7a7390547afaea6427f53e4df1d3d108b (patch)
tree40be34698ebf6341f1fd461a248646396d314dc1 /old-configure
parent58a9610acfc264cd93def625157774a8dc0e79ed (diff)
downloadmpv-4b5c3ea7a7390547afaea6427f53e4df1d3d108b.tar.bz2
mpv-4b5c3ea7a7390547afaea6427f53e4df1d3d108b.tar.xz
terminal-unix: new input handling code
This is independent of terminfo/termcap, and supports more keys. Originally, the goal was just extending the set of supported key sequences, but since the terminfo stuff actually makes this much harder, and since it's a big blob of bloated legacy crap, just drop it. Instead, use hardcoded tables. It's pretty easy to get on the same level as the old code (with fewer LOC), and we avoid additional error situations, such as mallocs which could fail (the old code just ignores malloc failures). We also try to support some xterm escape sequences, which are in relatively widespread use. (I'm not sure about the urxvt ones.) Trying to deal with xterm shift/ctrl/alt modifiers is probably a bit overcomplicated, and only deals with prefixes - xterm randomly uses prefix sequences for some keys, and suffixes for others (what the heck). Additionally, try to drop unknown escape codes. This basically relies on a trick: in almost 100% of all situations, a read() call will actually return complete sequences (possibly because of pipe semantics and atomic writes from the terminal emulator?), so it's easy to drop unknown sequences. This prevents that they trigger random key bindings as the code interprets the part after ESC as normal keys. This also drops the use of terminfo for sending smkx/rmkx. It seems even vt100 (to which virtually everything non-legacy is reasonably compatible with) supports the codes we hardcode, so it should be fine. This commit actually changes only the code if terminfo/termcap are not found. The next commit will make this code default.
Diffstat (limited to 'old-configure')
0 files changed, 0 insertions, 0 deletions