Commit Graph

590 Commits

Author SHA1 Message Date
Nicholas Marriott
10e05f9867 Tweak a comment and add some spacing. 2009-11-13 19:58:32 +00:00
Nicholas Marriott
76ef8770cd Get rid of the ugly CMD_CHFLAG macro and use a const string (eg "dDU") in the
command entry structs and a couple of functions to check/set the flags.
2009-11-13 19:53:28 +00:00
Nicholas Marriott
dafa0f022c Unreachable statement, found by lint. 2009-11-13 18:59:14 +00:00
Nicholas Marriott
390472566c Tidy up and fix some types, prompted by lint via deraadt. 2009-11-13 18:13:18 +00:00
Nicholas Marriott
a18a374d51 imsg_read returns ssize_t not int, pointed out by lint via deraadt. 2009-11-13 18:07:52 +00:00
Nicholas Marriott
8e47966225 Destroy panes immediately rather than checking them all every loop. 2009-11-13 17:33:07 +00:00
Nicholas Marriott
1415eb3dd2 Use winlink_remove() to remove old winlinks when synchronizing grouped sessions
rather than doing it manually and not adjusted the reference count. Fixes
crash seen by Dan Harnett.
2009-11-13 14:47:31 +00:00
Nicholas Marriott
5d397462e4 Zap unused functions, prompted by deraadt. 2009-11-13 07:00:54 +00:00
Nicholas Marriott
5ae542e7ee Emulate the ri (reverse index) capability: this allows tmux to at least start
on Sun consoles (TERM=sun or sun-color), even if there appear to still be
problems on some boxes (my Blade 100 is fine but edd's Blade 1000 shows odd
screen corruption).
2009-11-12 08:05:23 +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
89763f2ace Rewrite a confusing loop when freeing the arg array on exit and move the check
for argv being NULL, prompted by parfait via deraadt.

Also fix some definite brokenness when assigning multiple environment variables
in arguments (such as "X=1 Y=2").
2009-11-11 18:56:07 +00:00
Nicholas Marriott
9df4e7597d Add an explicit zero-length check for UTF-8 input data, prompted by a report
from parfait via deraadt.

While here, add a statement to set the width when filling with _s if not enough
space (width should never be high enough at the moment anyway), and wrap some
long lines.
2009-11-11 18:53:21 +00:00
Nicholas Marriott
08a8ccf46b Free the pane bufferevent when the fd is closed (the signal could come before
the error callback).
2009-11-11 13:24:42 +00:00
Nicholas Marriott
2756437f4b Only need to chmod +x or -x the socket when a client is created, lost or
attached, rather than every event loop.
2009-11-11 08:00:42 +00:00
Nicholas Marriott
15b9946a40 There is no real standard for modifier plus function keys. Previously, tmux
output some from rxvt but in other ways did the same as xterm or other
terminals, but this is a bit inconsistent.

xterm's method is fairly sensible and we already support it (xterm-keys), so
enable it by default instead.
2009-11-10 18:53:11 +00:00
Nicholas Marriott
d9961f40bf Don't output rxvtisms either. 2009-11-10 18:48:03 +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
b92fcf23fd Whoops, this is needed for last commit as well. 2009-11-10 17:41:35 +00:00
Nicholas Marriott
38f64b3da3 Lookup key as a named key (eg 'Space') before checking for single character
keys, makes C-Space/M-Space etc resolve to the correct key code.
2009-11-10 17:24:43 +00:00
Nicholas Marriott
9f47c6083a Don't return 1 unless there was actually a problem (signal/lost server) rather
than for all events (normal exit/detach/etc).
2009-11-10 15:47:48 +00:00
Nicholas Marriott
6609093625 Just ignore tty fd errors rather than dying, stops the server dying if the
session is disconnected abrubtly (eg ssh ~.).
2009-11-09 22:50:29 +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
f98d13e7dc Don't try enable/disable the event if the window pane is dead (fd == -1), as
the event will have been freed.
2009-11-06 10:42:06 +00:00
Nicholas Marriott
bed8153ba0 Clear to the end of the screen from the right starting point when drawing
line-by-line (in panes or if ed not supported). Fixes problem spotted by Frank
Terbeck.
2009-11-05 22:35:28 +00:00
Nicholas Marriott
297ebb1160 Old xterm F1-F4 are \033O_P not \033[O_P. 2009-11-05 19:35:16 +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
05855393f0 key_string_lookup_key uses a static buffer, so copy its output into the working
buffer before calling the command print function which can also use it (eg
send-keys).
2009-11-05 12:04:50 +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
25c604fb1c EVLOOP_ONCE takes care of the wakeup, so no need to call event_loopexit(NULL). 2009-11-05 08:50:32 +00:00
Nicholas Marriott
38e13942ac Now all timers are events, there is no longer any need to wake up every 50 ms -
only wake up when an event happens.
2009-11-05 08:48:15 +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
80444436f3 Convert the key repeat timer to an event. 2009-11-05 00:05:00 +00:00
Nicholas Marriott
44d6a2c435 Change window name change to use a timer event rather than a gettimeofday()
check every loop.
2009-11-04 23:54:57 +00:00
Nicholas Marriott
946ed97273 Move status timer check into the global once-per-second timer, this could maybe
be done better but one every second is better than once every 50 ms.
2009-11-04 23:42:51 +00:00
Nicholas Marriott
b1264a7416 Use timeout events for the identify and message timers. 2009-11-04 23:29:42 +00:00
Nicholas Marriott
b3c4956efe Don't reenlist the client imsg event every loop, instead have a small function
to it and call it after the event triggers or after a imsg is added.
2009-11-04 23:12:43 +00:00
Nicholas Marriott
6a6a42aa3a It would help if I read my own comments... make alt keys work again by sending
alt AND the key not alt instead of it.
2009-11-04 23:00:22 +00:00
Nicholas Marriott
862fe15c32 Move some common code into a function. 2009-11-04 22:57:49 +00:00
Nicholas Marriott
fde36fccc3 Tell the client to exit on configuration file error. 2009-11-04 22:47:34 +00:00
Nicholas Marriott
5bebbd81d7 Bye-bye buffer*.c. 2009-11-04 22:44:53 +00:00
Nicholas Marriott
a02c7e804c Convert the window pane (pty master side) fd over to use a bufferevent.
The evbuffer API is very similar to the existing tmux buffer API so this was
remarkably painless. Not many possible ways to do it, I suppose.
2009-11-04 22:43:11 +00:00
Nicholas Marriott
06ffed3216 Call event_init() before loading the config file, since potentially it could
set up events.
2009-11-04 22:40:36 +00:00
Nicholas Marriott
91ad830c88 Switch window pane pipe redirect fd over to a bufferevent. 2009-11-04 22:02:38 +00:00
Nicholas Marriott
7342615c7d Switch tty fds over to a bufferevent. 2009-11-04 21:47:42 +00:00
Nicholas Marriott
abb728684b Add back JOB_PERSIST checks that got lost. 2009-11-04 21:10:49 +00:00
Nicholas Marriott
4d6091379b Switch jobs over to use a bufferevent. 2009-11-04 21:04:43 +00:00
Nicholas Marriott
ea8c8c5f33 A couple of minor cosmetic changes. 2009-11-04 20:59:22 +00:00
Nicholas Marriott
abf3a5d50e Initial changes to move tmux to libevent.
This moves the client-side loops are pretty much fully over to event-based only
(tmux.c and client.c) but server-side (server.c and friends) treats libevent as
a sort of clever poll, waking up after every event to run various things.

Moving the server stuff over to bufferevents and timers and so on will come
later.
2009-11-04 20:50:11 +00:00