Commit Graph

1142 Commits (eb1f8d70a7d1fe4b0fe604d5a36fcbc2babef249)

Author SHA1 Message Date
Nicholas Marriott b9a179089b __progname is not const, pointed out by deraadt. 2009-07-21 18:38:52 +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 54afcfbfb4 Display the number of failed password attempts (if any) when the server is
locked. From Tom Doherty.
2009-07-20 14:37:51 +00:00
Nicholas Marriott 6036bdd06c Improved layout code.
Each window now has a tree of layout cells associated with it. In this tree,
each node is either a horizontal or vertical cell containing a list of other
cells running from left-to-right or top-to-bottom, or a leaf cell which is
associated with a pane.

The major functional changes are:

- panes may now be split arbitrarily both horizontally (splitw -h, C-b %) and
  vertically (splitw -v, C-b ");
- panes may be resized both horizontally and vertically (resizep -L/-R/-U/-D,
  bound to C-b left/right/up/down and C-b M-left/right/up/down);
- layouts are now applied and then may be modified by resizing or splitting
  panes, rather than being fixed and reapplied when the window is resized or
  panes are added;
- manual-vertical layout is no longer necessary, and active-only layout is gone
  (but may return in future);
- the main-pane layouts now reduce the size of the main pane to fit all panes
  if possible.

Thanks to all who tested.
2009-07-19 13:21:40 +00:00
Nicholas Marriott fc6a65c620 Add three new session options: visual-activity, visual-bell, visual-content. If
these are enabled (and the monitor-activity, bell-actio and monitor-content
options are configurated appropriately), when activity, a bell, or content is
detected, a message is shown.

Also tidy up the bell/activity/content code in server.c slightly and fix a
couple of errors.
2009-07-18 14:59:25 +00:00
Nicholas Marriott 0ca6f667e3 Make it so using kill-pane to destroy the last pane in a window destroys the
window instead of being an error.
2009-07-17 20:37:03 +00:00
Nicholas Marriott 6f5150a943 - New command display-message (alias display) to display a message in the
status line (bound to "i" and displays the current window and time by
  default). The same substitutions are applied as for status-left/right.
- Add support for including the window index (#I), pane index (#P) and window
  name (#W) in the message, and status-left or status-right.
- Bump protocol version.

From Tiago Cunha, thanks!
2009-07-17 18:45:08 +00:00
Nicholas Marriott ce53936a2b Tidy up new-session and attach-session and change them to work from inside
tmux, switching the current client to the new or requested session.

Written with Josh Elsasser.
2009-07-17 15:03:11 +00:00
Nicholas Marriott 216df07688 A similar for fix for window_choose: don't rely on the callback always being
called to free data, have a separate free callback and call it from the mode
cleanup code.
2009-07-17 07:05:58 +00:00
Nicholas Marriott 65deba3a35 Memory could be leaked if a second prompt or message appeared while another was
still present, so add a separate prompt free callback and make the _clear
function responsible for calling it if necessary (rather than the individual
prompt callbacks). Also make both messages and prompts clear any existing when
a new is set.

In addition, the screen could be modified while the prompt is there, restore
the redraw-entire-screen behaviour on prompt clear; add a comment as a
reminder.
2009-07-17 06:13:27 +00:00
Nicholas Marriott 92da443a9e Make status_message_set a variadic printf-like function. No functional change -
helpful for a couple of things coming soon.
2009-07-15 17:39:00 +00:00
Nicholas Marriott ca617d679f Having to update NSETOPTION/NSETWINDOWOPTION when adding new options is a bit
annoying and it is only use for iterating, so use a sentinel to mark the end of
each array instead. Different fix for a problem pointed out by Kalle Olavi
Niemitalo.
2009-07-15 07:50:34 +00:00
Nicholas Marriott 615d85fb23 Add main-pane-height to the options list (was missed before). 2009-07-14 20:20:04 +00:00
Nicholas Marriott ae2ea52575 Instead of faking up a status line in status_redraw, use the same code to
redraw it as to draw the entire screen, just skip all lines but the last.

This makes horizontal split redraw properly when the status line is off.
2009-07-14 19:03:16 +00:00
Nicholas Marriott fe20c0d89e Get rid of the PANE_HIDDEN flag in favour of a function, and moving the
decision for whether or not a pane should be drawn out of the layout code and
into the redraw code.

This is needed for the new layout design, getting it in now to make that easier
to work on.
2009-07-14 07:23:36 +00:00
Nicholas Marriott 5f108d9df6 Having fixed flags for single-character getopt options is a bit hard to
maintain and is only going to get worse as more are used. So instead, add a new
uint64_t member to cmd_entry which is a bitmask of upper and lowercase options
accepted by the command.

This means new single character options can be used without the need to add it
explicitly to the list.
2009-07-13 23:11:35 +00:00
Nicholas Marriott 023d8d38ec Tidy up and improve target (-t) argument parsing:
- move the code back into cmd.c and merge with the existing functions where
  possible;
- accept "-tttyp0" as well as "-t/dev/ttyp0" for clients;
- when looking up session names, try an exact match first, and if that fails
  look for it as an fnmatch pattern and then as the start of a name - if more
  that one session matches an error is given; so if there is one session called
  "mysession", -tmysession, -tmysess, -tmysess* are equivalent but if there
  is also "mysession2", the last two are errors;
- similarly for windows, if the argument is not a valid index or exact window
  name match, try it against the window names as an fnmatch pattern and a
  prefix.
2009-07-13 17:47:46 +00:00
Nicholas Marriott 359285928b Support "alternate screen" mode (terminfo smcup/rmcup) typically used by full
screen interactive programs to preserve the screen contents. When activated, it
saves a copy of the visible grid and disables scrolling into and resizing out
of the history; when deactivated the visible data is restored and the history
reenabled.
2009-07-13 10:43:52 +00:00
Nicholas Marriott 0b788a3d61 Missed this declaration in key bindings change. Whoops. 2009-07-12 23:46:49 +00:00
Nicholas Marriott 22d51ec1ea Add a "back to indentation" key in copy mode to move the cursor to the first
non-whitespace character. ^ with vi and M-m with emacs key bindings. Another
from Kalle Olavi Niemitalo, thanks.
2009-07-12 16:15:34 +00:00
Nicholas Marriott 22355ce947 If it exist, load a system-wide configuration file /etc/tmux.conf before any
user-specified one.
2009-07-12 16:07:56 +00:00
Nicholas Marriott 2f7198246e When pasting, translate \n into \r. This matches xterm and putty's behaviour,
and makes emacs happy when pasting into some modes. A new -r (raw) flag to
paste-buffer pastes without the translation.

From Kalle Olavi Niemitalo, thanks!
2009-07-11 19:14:56 +00:00
Nicholas Marriott daa1faa905 Add a default-terminal option to set the starting value of $TERM in new
windows.

This is "screen" by default and must be either that or something closely
related. This does makes it easier to customise it if necessary.
2009-07-10 05:50:54 +00:00
Nicholas Marriott 81181bfb72 New command, if-shell (alias if). Executes the tmux command in the second
argument if the shell command in the first succeeds, for example:

       if "[ -e ~/.tmux.conf.alt ]" "source .tmux.conf.alt"

Written by Tiago Cunha, many thanks.
2009-07-09 15:47:49 +00:00
Nicholas Marriott 643c219d18 Tidy by removing unused argument from grid_view_{insert,delete}_line_region
functions (currently don't fully work, this is to make fix easier).
2009-07-09 00:29:32 +00:00
Nicholas Marriott 084d07f4eb Just appending -l to $SHELL to create a login shell is wrong: -l is not POSIX,
and some people may use shells which do not support it. Instead, make an empty
default-command option mean a login shell, and fork it with a - in argv[0]
which is the method used by login(1).

Also fix the automatic-rename code to handle this correctly and to strip a
leading - if present.
2009-07-08 05:26:45 +00:00
Nicholas Marriott 923ccfa2e8 Rename the global options variables to be shorter and to make session options
clear. No functional change, getting this out of the way to make later options
changes easier.
2009-07-07 19:49:19 +00:00
Nicholas Marriott b11b1dd1c0 Remove some unused function declarations; no binary change. 2009-06-26 19:44:36 +00:00
Nicholas Marriott e225ce0fd7 #ifndef nitems to avoid redefining it if it is already in a header. 2009-06-25 22:08:15 +00:00
Nicholas Marriott a7075f1c66 tmux doesn't and won't need syslog logging, so remove it and some other unused
functions found by lint.

Also move a couple of internal function declarations into file scope.
2009-06-25 06:23:10 +00:00
Nicholas Marriott 1675ddb4d1 Miscellaneous unused functions, including one which was basically a
duplicate. Found by lint.
2009-06-25 06:15:04 +00:00
Nicholas Marriott ed8350422e Nuke unused buffer functions. Found by lint.
Also remove some old debug output which was #if 0.
2009-06-25 06:05:47 +00:00
Nicholas Marriott 7e796dea03 Change find-window and monitor-content to use fnmatch(3). For convenience and
compatibility, *s are implicitly added at the start and end of the pattern.

Also display the line number and the entire line in the results, and lose the
nasty section_string function and the now empty util.c file.

Initially from Tiago Cunha.
2009-06-24 22:49:56 +00:00
Nicholas Marriott 096cbf2ea5 Add a dedicated function to convert a line into a string and use it to simplify the search window function. 2009-06-24 22:04:18 +00:00
Nicholas Marriott 2de599ac0e Trying to predict the cursor position for UTF-8 output in the same way as for
normal eight-bit output is wrong, separate it into a different function. Fixes
spacing when mixing UTF-8 with some escape sequences, notably the way w3m does
it.
2009-06-24 16:01:02 +00:00
Nicholas Marriott 27cfa81110 Constify utf8_width() function argument. 2009-06-24 05:35:07 +00:00
Nicholas Marriott d42fb43f4f Proper support for tab stops (\033H etc), using a bitstring(3). Makes another
vttest test happy.
2009-06-04 18:48:24 +00:00
Nicholas Marriott 52ec9b9ec4 Implement the DEC alignment test. With the last change this is enough for the
first cursor test in vttest (in ports) to pass; it still shops a few more
problems though.
2009-06-03 23:30:40 +00:00
Nicholas Marriott 6521427a45 New session option, status-utf8, to control the interpretation of top-bit-set
characters in status-left and status-right (if on, they are treated as UTF-8;
otherwise passed through).
2009-06-03 16:54:26 +00:00
Nicholas Marriott 7d45e29683 Add a UTF-8 aware string length function and make UTF-8 in
status-left/status-right work properly. At the moment any top-bit-set
characters are assumed to be UTF-8: a status-utf8 option to configure this will
come shortly.
2009-06-03 16:05:46 +00:00
Nicholas Marriott c5dbec9e85 When swapping pane positions, swap the PANE_HIDDEN flag as well, otherwise tmux
crashes when trying to find the new active pane.

While here, nuke an unused pane flag.

Fixes PR 6160, reported by and a slightly different version of diff tested by
ralf.horstmann at gmx.de.
2009-06-03 07:51:24 +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