Commit Graph

4031 Commits

Author SHA1 Message Date
Nicholas Marriott
6491274f60 Infrastructure and commands to manage the environment for processes started
within tmux.

There is a global environment, copied from the external environment when the
server is started and each sesssion has an (initially empty) session
environment which overrides it.

New commands set-environment and show-environment manipulate or display the
environments.

A new session option, update-environment, is a space-separated list of
variables which are updated from the external environment into the session
environment every time a new session is created - the default is DISPLAY.
2009-08-08 21:52:43 +00:00
Nicholas Marriott
e985629440 Tidy function a little by using a temporary variable. 2009-08-08 21:18:23 +00:00
Nicholas Marriott
90f8151ffd Options to set the colours and attributes for status-left/-right. From Thomas
Adam, thanks.
2009-08-08 20:36:42 +00:00
Nicholas Marriott
92cc3a6914 Handle ttyname(3) failure better. 2009-08-08 16:05:01 +00:00
Nicholas Marriott
06ddd3dcf8 Add a flags member to the grid_line struct and use it to differentiate lines
wrapped at the screen edge from those terminated by a newline. Then use this
when copying to combine wrapped lines together into one.
2009-08-08 15:57:49 +00:00
Nicholas Marriott
5e01b6d663 Change the way the grid is stored, previously it was:
- a two-dimensional array of cells;
- a two-dimensional array of utf8 data;
- an array of line lengths.

Now it is a single array of a new struct grid_line each of which represents a
line and containts the length and an array of cells and an array of utf8 data.

This will make it easier to add additional per-line members, such as flags.
2009-08-08 13:29:27 +00:00
Nicholas Marriott
e89e70e715 If there is an error in the configuration file, don't just exit(1) as this can
cause the client to hang. Instead, send the error message, then mark the client
as bad and start a normal shutdown so the server exits once the error is
written.

This also allows some code duplicating daemon(3) to be trimmed and logging to
begin earlier.

Prompted by Theo noticing the behaviour on error wasn't documented.
2009-08-07 15:39:10 +00:00
Nicholas Marriott
ccaf8724e4 Move introduction section up into description. From jmc. 2009-08-07 12:24:16 +00:00
Nicholas Marriott
04e97e8aef Using the alternative screen (smcup/rmcup) should also preserve the current
colours and attributes. Found thanks to a report from Taylor Venable.

While here also nuke a couple of extra blank lines.
2009-08-07 00:12:13 +00:00
Jason McIntyre
746fe5832a tweak INTRODUCTION; from nicm and myself 2009-08-06 21:06:35 +00:00
Nicholas Marriott
4027335fa9 Clear the codes array earlier as tty_term_free could be called on error. 2009-08-05 19:05:02 +00:00
Nicholas Marriott
bcddddf98d If colours are not supported by the terminal, try to emulate a coloured
background by setting or clearing the reverse attribute.

This makes a few applications which don't use the reverse attribute themselves
a little happier, and allows the status, message and mode options to have
default attributes and fg/bg options that work as expected when set as reverse.
2009-08-05 16:26:38 +00:00
Nicholas Marriott
12ef3ceda1 Add a -a flag to set-option and set-window-option to append to an existing
string value, useful for terminal-overrides.
2009-08-04 18:45:57 +00:00
Jason McIntyre
a0647f1616 restructure the layout of this page, moving the commands into various
subsections; lots of tweaks to come on the text

from nicm and myself
2009-08-04 18:41:28 +00:00
Nicholas Marriott
9e3bb986d5 Show the bell/activity/current status and the window title in the choice list. 2009-08-04 14:28:23 +00:00
Nicholas Marriott
93bf2a1d72 Check for "UTF8" as well as "UTF-8" in LANG etc as it seems this may also
appear.
2009-08-04 10:31:28 +00:00
Jason McIntyre
6b69b93b53 clean up some macro abuse in the commands section; 2009-08-04 07:56:38 +00:00
Nicholas Marriott
189fb08e13 Split the comparison into a function to make this code smaller and more
understandable.
2009-08-03 17:12:07 +00:00
Nicholas Marriott
ac54dee9bb Don't try to free old string values (and crash) when they are overridden unless
they were actually found in the source terminal description. Reported by jmc.
2009-08-03 15:30:16 +00:00
Jason McIntyre
9a391b3320 tweak previous; 2009-08-03 14:34:47 +00:00
Nicholas Marriott
1673735f02 Add a terminal-overrides session option allowing individual terminfo(5) entries
to be overridden. The 88col/256col checks are now moved into the default
setting and out of the code.

Also remove a couple of old workarounds for xterm and rxvt which are no longer
necessary (tmux can emulate them if missing).
2009-08-03 14:10:54 +00:00
Matthieu Herrb
e4bb08e1f5 Fix checking of setupterm(3) error codes. While there include the
name of the terminal type causing the error where relevant. ok nicm@.
2009-08-02 20:47:35 +00:00
Nicholas Marriott
5db47ed53a Pass the ACS border characters through tty_get_acs so they appear correctly on
terminals which don't use the standard set.
2009-07-31 10:12:49 +00:00
Nicholas Marriott
95caeaa5dc Don't leak when rollling buffers off when the paste buffer limit is reached. 2009-07-30 20:50:54 +00:00
Nicholas Marriott
97f105cde2 Plug some memory leaks. 2009-07-30 20:41:48 +00:00
Nicholas Marriott
61f3fc7e4d Don't babysit people and let them try to load /dev/zero or (more useful)
/dev/null if they want.
2009-07-30 17:46:12 +00:00
Nicholas Marriott
8df3035831 Remove some dead code found by clang. 2009-07-30 17:29:12 +00:00
Jason McIntyre
6d86882ed4 tweak previous; 2009-07-30 16:59:24 +00:00
Nicholas Marriott
9f1dd4d0af Similar changes for server_msg_dispatch: use a switch instead of a lookup table
and merge smaller functions inline.
2009-07-30 16:40:12 +00:00
Nicholas Marriott
5f13bb0c3a There aren't many client message types or code to handle them so get rid of the
lookup table and use a switch, merge the tiny handler functions into it, and
move the whole lot to client.c.

Also change client_msg_dispatch to consume as many messages as possible and
move the call to it to the right place so it checks for signals afterwards.

Prompted by suggestions from eric@.
2009-07-30 16:32:12 +00:00
Nicholas Marriott
479d614884 Tell the server when the client gets SIGTERM so it can clean up the terminal
properly, rather than just exiting.
2009-07-30 16:16:19 +00:00
Nicholas Marriott
071494d8fa Merge pane number into the target specification for pane commands. Instead of
using -p index, a target pane is now addressed with the normal -t window form
but suffixed with a period and a pane index, for example :0.2 or
mysess:mywin.1. An unadorned number such as -t 1 is tried as a pane index in
the current window, if that fails the same rules are followed as for a target
window and the current pane in that window used.

As a side-effect this now means that swap-pane can swap panes between different
windows.

Note that this changes the syntax of the break-pane, clear-history, kill-pane,
resize-pane, select-pane and swap-pane commands.
2009-07-30 13:45:56 +00:00
Jason McIntyre
a87228b4ff new sentence, new line; 2009-07-30 13:31:22 +00:00
Nicholas Marriott
a419e73f7a Add a mode-mouse option to prevent tmux taking over the mouse in choice or copy
modes.
2009-07-30 07:04:50 +00:00
Nicholas Marriott
2b331084b4 Add an additional heuristic to work out the current session when run from the
command line. The name of all slave ptys in the server is known, so if the
client was run on a tty, look for any sessions containing that tty and use the
most recently created.

This is more reliable than looking at $TMUX if windows have been moved or
linked between sessions.
2009-07-29 17:03:16 +00:00
Nicholas Marriott
c1d6d7ac6b Rename struct hdrtype to msgtype which is a better name and can be used even
when struct hdr disappears.
2009-07-29 14:17:26 +00:00
Nicholas Marriott
d3c461097b Taking account of the "s, 22 not 24 is the maximum length of #T in status-right
to prevent the date being cut off.
2009-07-29 05:36:53 +00:00
Nicholas Marriott
f596be9950 Final pieces of mode key rebinding: bind-key and unbind-key now accept a -t
argument to modify a table.
2009-07-28 17:05:10 +00:00
Nicholas Marriott
9e5d585ba4 Accept and print "Enter" and "Escape" for keys rather than C-m and C-[. 2009-07-28 09:18:01 +00:00
Nicholas Marriott
86785004ba Next step towards customisable mode keys: build each default table of keys into
a named tree on start and use that for lookups. Also add command to string
translation tables and modify list-keys to show the the mode key bindings (new
-t argument).
2009-07-28 07:03:32 +00:00
Nicholas Marriott
2da4864483 If select-layout is not given an argument, repply the last layout used in the
window, if any.
2009-07-28 06:48:44 +00:00
Nicholas Marriott
309b76fb32 Remove an unused entry in the mode keys command enum and rename
MODEKEYCOPY_QUIT to _CANCEL to match the others.
2009-07-27 20:36:13 +00:00
Nicholas Marriott
d95274c5f2 Change mode key bindings from big switches into a set of tables. Rather than
lumping them all together, split editing keys from those used in choice/more
mode and those for copy/scroll mode.

Tidier and clearer, and the first step towards customisable mode keys.
2009-07-27 19:29:35 +00:00
Nicholas Marriott
13e29dd7b5 Get rid of empty mode_key_free function. 2009-07-27 18:51:46 +00:00
Nicholas Marriott
ad0aad21d5 Add a key to delete to end of line at the prompt (^K in emacs mode, C/D in vi).
From Kalle Olavi Niemitalo.
2009-07-27 12:11:11 +00:00
Nicholas Marriott
fc65da1eed Draw UTF-8 characters under the selection correctly. 2009-07-27 11:33:21 +00:00
Nicholas Marriott
584eda8339 Change previous-word behavior to move to the beginning of the word (matches
emacs and vi). From Kalle Olavi Niemitalo.
2009-07-27 07:42:45 +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
55d8c01c33 Calculate the space available for the prompt buffer and the cursor position
correctly, and make it work when the screen is not wide enough.

Noticed by Kalle Olavi Niemitalo.
2009-07-26 21:13:47 +00:00
Nicholas Marriott
6b3b852ebc Go to the next if the current best process is replaced, don't keep comparing it
with itself. Also fix process name comparison.
2009-07-26 19:42:26 +00:00