Commit Graph

119 Commits

Author SHA1 Message Date
Nicholas Marriott
9c0147915e Handle the possibility of partial mouse reads, and fix a comment while here. 2009-11-26 15:14:03 +00:00
Tiago Cunha
ac6b1a817b Sync OpenBSD patchset 531:
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-13 16:56:15 +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
Tiago Cunha
9817d41947 Sync OpenBSD patchset 524:
Twiddling the last bit is an rxvtism, so do not support it in the table by
default.
2009-11-10 23:32:09 +00:00
Tiago Cunha
36bb298bfa Sync OpenBSD patchset 519:
The input key should be a u_char. Fixes top-bit-set input problem reported by
ajacoutot@.
2009-11-10 23:27:03 +00:00
Tiago Cunha
e275bc52f2 Sync OpenBSD patchset 518:
Constify buf.
2009-11-10 23:26:13 +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
Tiago Cunha
946337484e Sync OpenBSD patchset 514:
Unused variable. Aargh.
2009-11-08 23:33:17 +00:00
Tiago Cunha
181e1cc711 Sync OpenBSD patchset 513:
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-08 23:32:39 +00:00
Tiago Cunha
7d288e7fd8 Sync OpenBSD patchset 511:
Key flags are only used for initialisation so they are not needed in the main
tty_key struct.
2009-11-08 23:29:34 +00:00
Tiago Cunha
66957412d5 Sync OpenBSD patchset 508:
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-08 23:26:56 +00:00
Tiago Cunha
971a7b2fe0 Sync OpenBSD patchset 495:
Switch tty fds over to a bufferevent.
2009-11-08 22:58:38 +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
Tiago Cunha
31bb577075 Sync OpenBSD patchset 460:
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-28 23:05:01 +00:00
Tiago Cunha
10aab82539 Sync OpenBSD patchset 459:
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-28 23:03:51 +00:00
Tiago Cunha
1c4b7d33b1 Sync OpenBSD patchset 458:
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-28 23:01:44 +00:00
Tiago Cunha
c45a56d66b Sync OpenBSD patchset 455:
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-28 22:57:55 +00:00
Tiago Cunha
a8300b7a44 Sync OpenBSD patchset 454:
Tidy up table.
2009-10-28 22:56:50 +00:00
Tiago Cunha
4f7e669271 Sync OpenBSD patchset 450:
Rename keypad keys to something more useful.
2009-10-28 22:53:03 +00:00
Tiago Cunha
165538b4bd Sync OpenBSD patchset 449:
Remove the xterm-keys code which is broken (a replacement is coming but some
more cleanup is needed first).
2009-10-28 22:51:55 +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
Tiago Cunha
b26ea8462e Sync OpenBSD patchset 381:
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-12 00:18:19 +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
Tiago Cunha
3266fb5441 Sync OpenBSD patchset 332:
Regularise some fatal messages.
2009-09-20 22:11:27 +00:00
Nicholas Marriott
273f1b385c Regularise some fatal messages. 2009-09-20 14:58:12 +00:00
Tiago Cunha
361801aaaa Sync OpenBSD patchset 184:
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-28 22:37:02 +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
Tiago Cunha
a734488a4b Sync OpenBSD patchset 151:
Tidy up keys: use an enum for the key codes, and remove the macros which just
wrap flag sets/clears/tests.
2009-07-22 16:24:59 +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
Nicholas Marriott
525bd431b2 RB_INSERT returns &item if already exists, so use that rather than doing a
check beforehand.
2009-05-04 18:05:23 +00:00
Nicholas Marriott
143aa718e5 Space trimmage mega-diff. 2009-05-04 17:58:27 +00:00
Nicholas Marriott
750b8106f7 Remove the right number of characters from the buffer when escape then a cursor
key (or other key prefixed by \033) is pressed. Reported by Stuart Henderson.
2009-04-17 12:36:21 +00:00
Nicholas Marriott
171256057e Extra function keys from Dashing dashing at hushmail dot com 2009-03-02 18:05:40 +00:00
Nicholas Marriott
57f5f44d0f Sort out escape key handling so it works. 2009-03-02 16:55:23 +00:00
Nicholas Marriott
a766f9743a Don't leak existing keys. 2009-02-16 18:43:07 +00:00
Nicholas Marriott
4428987e95 * Better support for at least the most common variant of mouse input: parse it and adjust for different panes. Also support mouse in window/session choice mode.
* Bring back the fancy window titles with session/window names: it is easy to work around problems with elinks (see FAQ).
2009-01-28 19:52:21 +00:00
Nicholas Marriott
a88eba3805 More hacks for key handling. 2009-01-12 22:48:00 +00:00
Nicholas Marriott
dbbc314cc9 Handle ctrl/shift modifiers better. 2009-01-12 21:47:03 +00:00
Nicholas Marriott
312633203d Support btab. 2009-01-10 18:28:09 +00:00
Nicholas Marriott
a1b43faa43 Trim spaces. 2009-01-10 01:51:22 +00:00
Nicholas Marriott
3ed5aa3e72 Build array of codes, stop using ncurses global variables and push ncurses crap into tty-term.c. 2009-01-09 23:57:42 +00:00
Nicholas Marriott
e134458754 Handle arrow key variants. 2009-01-09 16:47:06 +00:00
Nicholas Marriott
ed1031b358 Update key handling code. Simplify, support ctrl properly and add a new window option (xterm-keys) to output xterm key codes including ctrl and, if available, alt and shift. 2009-01-09 16:45:58 +00:00
Nicholas Marriott
622d4def22 Give up the farce of caring about any keys aside from the ones in the screen termcap and the ones termcap doesn't handle that we hardcode manually. 2009-01-08 22:28:02 +00:00
Nicholas Marriott
4846ad1657 Introduce nitems() and use it; use bsearch. 2009-01-07 22:52:33 +00:00
Nicholas Marriott
62457bce0b Trim. 2008-09-26 06:45:28 +00:00
Nicholas Marriott
33aa931541 Support OS X by moving to gettimeofday(2) and adding poll compat from OpenSSH. 2008-08-28 17:45:30 +00:00
Nicholas Marriott
3337dfcae5 Support keypad mode, and get rid of SCREEN_DEF*. Meant to commit these separately but forgot :-/. 2008-07-24 21:42:40 +00:00
Nicholas Marriott
ee8a9d2458 Handle kcursor+kkeypad (switch to OA from [A). 2008-07-24 00:03:15 +00:00
Nicholas Marriott
97212771b5 Support keypad. Change cursor key output. 2008-07-23 23:44:50 +00:00
Nicholas Marriott
5942e22d71 Memory leaks. 2008-07-23 22:18:06 +00:00
Nicholas Marriott
758efb3947 Handle escaped keys properly and use M-f/M-b in copy mode. 2008-06-25 07:30:08 +00:00
Nicholas Marriott
91f3165b2d IRIX fixes thanks to Elias Pipping. 2008-06-23 16:58:49 +00:00
Nicholas Marriott
6a187bb8d3 Some Linux fixes; some code tidying. Don't redraw status bar so often. 2008-06-06 17:20:30 +00:00
Nicholas Marriott
103748d6ad Major reorganisation of screen handling. 2007-12-06 09:46:23 +00:00
Nicholas Marriott
76c8a590db Big internal reorganisation to move tty control into parent. 2007-11-27 19:23:34 +00:00