Commit Graph

139 Commits

Author SHA1 Message Date
Nicholas Marriott
e8dff68588 Handle partial keys properly by making sure the timer has actually
expired, fixes problems with mintty reported by Michael Simpson.
2012-04-22 05:21:40 +00:00
Nicholas Marriott
7c9d003e99 Some terminals respond to secondary DA with primary (they ignore the
intermediate character). So ignore the possible responses to primary DA.
2012-03-21 21:28:03 +00:00
Nicholas Marriott
d8805af66b On xterm 271 and later, put the terminal into SCL 5 and use DECCRA for
scrolling the region in panes (if the large region check isn't
hit). With help from Ailin Nemui.
2012-03-17 22:56:04 +00:00
Nicholas Marriott
d3c842d367 Check event_initialized before event_del if event may not have been set
up; libevent2 complains about this. Reported by Moriyoshi Koizumi.
2012-03-17 18:24:07 +00:00
Nicholas Marriott
c8c0d68128 Send secondary DA to terminals with XT in terminfo when starting up and
parse it to work out the xterm version.
2012-03-15 10:36:00 +00:00
Nicholas Marriott
d5ed5fb08f Two fixes by Micah Cowan: make mouse work properly beyond >127 on signed
char architectures and properly parse $TMUX by stopping the socket path
at the first comma.
2011-03-04 23:26:44 +00:00
Nicholas Marriott
ac3b78a841 Support for UTF-8 mouse input (\033[1005h). This was added in xterm 262
and supports larger terminals than the older way.

If the new mouse-utf8 option is on, UTF-8 mouse input is enabled for all
UTF-8 terminals. The option defaults to on if LANG etc are set in the
same manner as the utf8 option.

With help and based on code from hsim at gmx.li.
2011-01-03 23:35:21 +00:00
Nicholas Marriott
1c86713afd Key table should be const. 2011-01-01 02:16:25 +00:00
Nicholas Marriott
43fa9a9ba6 When the mode-mouse option is on, support dragging to make a selection
in copy mode.

Also support the scroll wheel, although xterm strangely does not ignore
it in application mouse mode, causing redraw artifacts when scrolling up
(other terminals appear to be better behaved).
2010-05-31 19:51:29 +00:00
Nicholas Marriott
021037c419 Accept a full key match (not a partial) even if there is data left in
the buffer.
2010-03-22 19:03:52 +00:00
Nicholas Marriott
19ea306606 Allow keys to be replaced and reorder the table so that terminfo-defined keys
(or terminal-overrides) take precedence over internally defined.
2009-12-17 17:39:56 +00:00
Nicholas Marriott
30962cb200 New server option, escape-time, to set the timeout used to detect if escapes
are alone or part of a function key or meta sequence.
2009-12-14 10:43:41 +00:00
Nicholas Marriott
15a64b805e Massive spaces->tabs and trailing whitespace cleanup, hopefully for the last
time now I've configured emacs to make them displayed in really annoying
colours...
2009-12-03 22:50:09 +00:00
Nicholas Marriott
f27fefd7b8 Look for mice and xterm keys before standard function keys as they are less
likely to be partial versions.
2009-12-01 07:59:40 +00:00
Nicholas Marriott
29a5931c6a Handle partial xterm function key sequences. 2009-11-30 16:44:03 +00:00
Nicholas Marriott
ba5404d93e Continue rather than returning if not a mouse key, to avoid hanging on any
function key...
2009-11-26 22:26:51 +00:00
Nicholas Marriott
4ca857e0e9 Remove a couple of unused arguments where possible, and add /* ARGSUSED */ to
the rest to reduce lint output.
2009-11-26 21:37:13 +00:00
Nicholas Marriott
9c0147915e Handle the possibility of partial mouse reads, and fix a comment while here. 2009-11-26 15:14:03 +00:00
Nicholas Marriott
d9deb4b530 Support rxvt-style keys again, but this time: support all the variations, put
them in as raw escape sequences rather than fiddling with the values from
terminfo, put them /after/ the terminfo values so the latter take precedence.
2009-11-12 08:01:02 +00:00
Nicholas Marriott
05831b52c4 Twiddling the last bit is an rxvtism, so do not support it in the table by
default.
2009-11-10 17:59:34 +00:00
Nicholas Marriott
591fa23f6e The input key should be a u_char. Fixes top-bit-set input problem reported by
ajacoutot@.
2009-11-09 14:40:06 +00:00
Nicholas Marriott
daf150c38d Constify buf. 2009-11-09 11:45:10 +00:00
Nicholas Marriott
ff55eb5bfa Unused variable. Aargh. 2009-11-05 19:32:34 +00:00
Nicholas Marriott
80e0158112 Switch the tty key tree over to an (unbalanced) ternary tree which allows
partial matches to be done (they wait for further data or a timer to expire,
like a naked escape).

Mouse and xterm-style keys still expect to be atomic.
2009-11-05 19:29:41 +00:00
Nicholas Marriott
a790e16fa2 Key flags are only used for initialisation so they are not needed in the main
tty_key struct.
2009-11-05 10:44:36 +00:00
Nicholas Marriott
b58bf49e91 Switch tty key input over to happen on a read event. This is a bit more
complicated because of escape input, but in that case instead of processing a
key immediately, schedule a timer and reprocess the bufer when it expires.

This currently assumes that keys will be atomic (ie that if eg F1 is pressed
the entire sequence is present in the buffer). This is usually but not always
true, a change in the tree format so it can differentiate potential (partial)
key sequences will happens soon and will allow this to be fixed.
2009-11-05 08:45:08 +00:00
Nicholas Marriott
7342615c7d Switch tty fds over to a bufferevent. 2009-11-04 21:47:42 +00:00
Nicholas Marriott
e831649b64 Not all terminals swap CSI and SS3 on ctrl, so remove that.
Also mark the rxvt special-cases as such until terminfo is updated to have
kLFT5, kRIT5 etc.
2009-10-26 17:59:46 +00:00
Nicholas Marriott
fd2ef18a70 Rewrite xterm-keys code (both input and output) so that works (doesn't always
output the same modifiers, accepts all the possible input keys) and is more
understandable.
2009-10-26 17:46:33 +00:00
Nicholas Marriott
c92c2bfb10 Support the (mostly new) function key+modifier caps (kIC-kIC7). Most of these
will be caught (soon) by the xterm keys code in xterm itself but some other
descriptions such as rxvt define them as well.
2009-10-26 16:00:51 +00:00
Nicholas Marriott
d0aa883e07 As we always put the cursor keys into application mode, assume keys sent
with CSI have ctrl.

Also add a couple of comments.
2009-10-26 13:58:02 +00:00
Nicholas Marriott
fcd3b260ac Tidy up table. 2009-10-26 13:41:46 +00:00
Nicholas Marriott
db4452d307 Rename keypad keys to something more useful. 2009-10-26 13:13:33 +00:00
Nicholas Marriott
10a656eedb Remove the xterm-keys code which is broken (a replacement is coming but some
more cleanup is needed first).
2009-10-26 13:02:53 +00:00
Nicholas Marriott
4bc0f6e7e9 Clean up by introducing a wrapper struct for mouse clicks rather than passing
three u_chars around.

As a side-effect this fixes incorrectly rejecting high cursor positions
(because it was comparing them as signed char), reported by Tom Doherty.
2009-10-11 07:01:10 +00:00
Nicholas Marriott
273f1b385c Regularise some fatal messages. 2009-09-20 14:58:12 +00:00
Nicholas Marriott
639fbe0392 Detect backspace by looking at termios VERASE and translate it into \177 (which
matches screen's behaviour if not its termcap/terminfo entry). The terminfo kbs
cap is often wrong or missing so it can't be used, and just assuming \177 may
be wrong.
2009-07-26 21:42:08 +00:00
Nicholas Marriott
725938fb85 Tidy up keys: use an enum for the key codes, and remove the macros which just
wrap flag sets/clears/tests.
2009-07-21 17:57:29 +00:00
Nicholas Marriott
35876eaab9 Import tmux, a terminal multiplexor allowing (among other things) a single
terminal to be switched between several different windows and programs
displayed on one terminal be detached from one terminal and moved to another.

ok deraadt pirofti
2009-06-01 22:58:49 +00:00