Commit Graph

531 Commits (62bb6e37e0bdc2de2a20f7adc38993d2ccfd8c11)

Author SHA1 Message Date
nicm 592cb73a69 grid_marker_cell is no longer used. 2015-05-08 16:44:03 +00:00
nicm 74b2c40b1b mode_key_entry can go into mode-key.c; also a few spaces->tabs. 2015-05-08 16:33:29 +00:00
nicm a538141a72 window_choose_mode_item can move into window-choose.c. 2015-05-08 16:23:34 +00:00
nicm c4a4bd6ac5 Move input parser structs into input.c (removing fairly useless
saved_cursor_[xy] formats as a side-effect).
2015-05-08 16:18:04 +00:00
nicm 1282bb81fe array.h can be local to window-choose.c now. 2015-05-07 08:08:54 +00:00
nicm 0b39e6427f Remove ARRAY_* from history and expand completion to complete a) layout
names and b) targets beginning with -t or -s.
2015-05-06 23:56:46 +00:00
nicm 31b1ab4852 Add a format window_linked which is 1 if a window has been linked
multiple times, also remove the default space in window_flags and use a
conditional to add it in window-status-format (this means additional
flags can be added in the option without extra spaces). From Thomas Adam
with tweaks by me.
2015-05-06 08:35:39 +00:00
nicm 771744426e Add select-layout -o to undo the last layout change (apply the previously
set layout).
2015-04-28 10:43:13 +00:00
nicm 95195f5258 Rewrite of the target resolution internals to be simpler and more
consistent but with much less duplication, but keeping the same internal
API. Also adds more readable aliases for some of the special tokens used
in targets (eg "{start}" instead of "^"). Some behaviours may have
changed, for example prefix matches now happen before fnmatch.
2015-04-27 16:25:57 +00:00
nicm 07dfdb974d Make message log a TAILQ. 2015-04-25 18:33:59 +00:00
nicm 6dbd63ba4f Move the functions to convert ids from strings into session.c and window.c. 2015-04-25 18:09:28 +00:00
nicm aeedb464a6 Convert clients list into a TAILQ. 2015-04-24 23:17:11 +00:00
nicm 583b4ab72b Set working directory for run-shell and if-shell. 2015-04-24 22:19:36 +00:00
nicm 9a453dd354 Make session_has return a flag, returning the first winlink found is a
recipe for errors.
2015-04-22 15:32:33 +00:00
nicm 8d66f4fba4 Change the windows array into an RB tree and fix some places where we
were only looking at the first winlink for a window in a session.
2015-04-22 15:30:11 +00:00
nicm 89e80cabd5 window_index is only used in one place (window_destroy) so inline it there. 2015-04-22 15:05:03 +00:00
nicm 69f292a90e Always format real layout even when zoomed. 2015-04-21 22:38:49 +00:00
nicm bded743706 Support for multiple key tables to commands to be bound to sequences of
keys. The default key bindings become the "prefix" table and -n the
"root" table. Keys may be bound in new tables with bind -T and
switch-client -T used to specify the table in which the next key should
be looked up. Based on a diff from Keith Amling.
2015-04-20 15:34:56 +00:00
nicm bf635e7741 Rewrite of tmux mouse support which was a mess. Instead of having
options for "mouse-this" and "mouse-that", mouse events may be bound as
keys and there is one option "mouse" that turns on mouse support
entirely (set -g mouse on).

See the new MOUSE SUPPORT section of the man page for description of the
key names and new flags (-t= to specify the pane or window under mouse
as a target, and send-keys -M to pass through a mouse event).

The default builtin bindings for the mouse are:

    bind -n   MouseDown1Pane select-pane -t=; send-keys -M
    bind -n MouseDown1Status select-window -t=
    bind -n   MouseDrag1Pane copy-mode -M
    bind -n MouseDrag1Border resize-pane -M

To get the effect of turning mode-mouse off, do:

    unbind -n MouseDrag1Pane
    unbind -temacs-copy MouseDrag1Pane

The old mouse options are now gone, set-option -q may be used to
suppress warnings if mixing configuration files.
2015-04-19 21:34:21 +00:00
nicm ee123c2489 Support setting the default window and pane background colours (window
and active pane via window-style and window-active-style options, an
individual pane by a new select-pane -P flag). From J Raynor.
2015-04-19 21:05:27 +00:00
nicm 313f2263f8 status_replace can now become local to status.c and it no longer needs
the jobsflag argument. While here there is no need to repeat work that
format_defaults already does.
2015-02-06 17:21:08 +00:00
nicm 03758a50dc Add format_expand_time and use it instead of status_replace where
command execution is not needed.
2015-02-06 17:11:39 +00:00
nicm 4946f74253 Wrap all the individual format_* calls in a single format_defaults
functions.
2015-02-05 10:29:43 +00:00
nicm e5d9ceff18 There is no need to save the guard state because the function checks it
again anyway.
2015-02-05 10:26:29 +00:00
nicm c9642ee213 Remove two unused arguments from status_replace. 2015-02-01 23:43:23 +00:00
nicm 16bdd970dc Support blinking cursor mode, both the xterm CSI ?12 h/l and (the
backwards) screen CSI 34 h/l. From Guanpeng Xu.
2015-01-20 08:18:04 +00:00
nicm 7a0c94b28a Add pane_dead_status for exit status of dead panes. 2014-12-09 19:23:35 +00:00
nicm 575fd1e322 Permit option values to be used in formats. 2014-12-02 23:19:45 +00:00
nicm c403bfc894 Remove dead code, from Thomas Adam. 2014-11-30 08:03:29 +00:00
nicm e0929262db Label windows which are smaller than expected with a reason. 2014-11-14 02:19:47 +00:00
nicm e4bf1e5128 Add V for select line with vi(1) keys. From Juho Pohjala. 2014-11-06 09:17:25 +00:00
nicm b496b1fe11 Move cfg_causes local into cfg.c and remove struct causelist. 2014-10-27 22:23:47 +00:00
nicm 68cb1c0e6b Merge unlink-window into kill-window. 2014-10-22 23:11:41 +00:00
nicm a02c2e55c0 Only redraw pane when it has actually changed. 2014-10-21 22:22:04 +00:00
nicm 0a1a88d63c Better format for printf format attributes. 2014-10-20 23:57:13 +00:00
nicm 4c42381410 Move template defines back into .c files. 2014-10-20 23:35:28 +00:00
nicm 900f6fc17e Tidy up some includes. 2014-10-20 23:27:14 +00:00
nicm 45dfc5a074 Instead of setting up the default keys by building the key struct
directly with a helper function in the cmd_entry, include a table of
bind-key commands and pass them through the command parser and a
temporary cmd_q.

As well as being smaller, this will allow default bindings to be command
sequences which will probably be needed soon.
2014-10-20 22:29:25 +00:00
nicm a27ba6e380 Add xreallocarray and remove nmemb argument from xrealloc. 2014-10-08 17:35:58 +00:00
nicm 733cea8847 Wake up any clients waiting with the wait-for command when the server
exits.
2014-09-01 21:58:41 +00:00
nicm 4e956d545a Various minor style and spacing nits. 2014-09-01 21:50:18 +00:00
nicm 29d20a55b6 Fix two copy mode problems:
1. In vi mode the selection doesn't include the last character if you
   moved the cursor up or left.
2. In emacs mode the selection includes the last character if you moved
   the cursor to the left.

From Balazs Kezes.
2014-08-11 22:18:16 +00:00
nicm f518a077b1 Add flags to selectp to enable and disable input to a pane, from Anish
Athalye.
2014-08-11 22:14:30 +00:00
nicm 1ac96200a7 Remove support for the continuous reporting "any" mouse mode which never
really worked properly and is rarely used.
2014-08-09 07:33:37 +00:00
nicm 2056a9ef9e Drop explicit support for F13-F20 and change to match the xterm terminfo
entry:

        F13-F24 are S-F1 to S-F12
        F25-F36 are C-F1 to C-F12
        F37-F48 are C-S-F1 to C-S-F12
        F49-F60 are M-F1 to M-F12
and     F61-F63 are M-S-F1 to M-S-F3

This should be no difference for applications inside tmux, but means
that any key binding for F13 will need to be replaced by S-F1 and so on.
2014-07-21 10:25:48 +00:00
nicm 21ade85f24 Properly track switching G0 and G1 modes between US-ASCII and VT100 line
drawing rather than just treating them as SO and SI.
2014-06-06 13:21:41 +00:00
nicm 53cbae544f Now that cmdlists are reference counted, there is no need for two-step
deletion via the dead_key_bindings tree. From Keith Amling.
2014-05-14 06:21:19 +00:00
nicm b3e8d440ed If multiple arguments are given to new-session, new-window,
split-window, respawn-window or respawn-pane, pass them directly to
execvp() to help avoid quoting problems. One argument still goes to "sh
-c" like before. Requested by many over the years. Patch from J Raynor.
2014-05-13 08:08:32 +00:00
nicm b1a06ef22e Add a copy mode key binding to copy to a named buffer. From J Raynor. 2014-05-13 07:54:20 +00:00
nicm 3dbacbb62b Add support for named buffers. If you don't name a buffer, things work
much as before - buffers are automatically named "buffer0000",
"buffer0001" and so on and ordered as a stack. Buffers can be named
explicitly when creating ("loadb -b foo" etc) or renamed ("setb -b
buffer0000 -n foo"). If buffers are named explicitly, they are not
deleted when buffer-limit is reached. Diff from J Raynor.
2014-05-13 07:34:35 +00:00
nicm f4ffaf5a7f Just use char ** for argv like normal people, not char *const *. 2014-05-09 09:11:24 +00:00
nicm 94ccc6aeaa Instead of forcing mouse scroll to 1 in choose mode, scale it down
instead. Means modifier keys still increase the line count, just not as
much. Based on a diff from Marcel Partap.
2014-05-08 07:54:47 +00:00
nicm 540f0b3e45 Both the two previous ways of navigating panes by direction have
irritating flaws:

a) The old way of always using the top or left if the choice is
ambiguous is annoying when the layout is unbalanced.

b) The new way of remembering the last used pane is annoying if the
layout is balanced and the leftmost is obvious to the user (because
clearly if we go right from the top-left in a tiled set of four we want
to end up in top-right, even if we were last using the bottom-right).

So instead, use a combination of both: if there is only one possible
pane alongside the current pane, move to it, otherwise choose the most
recently used of the choice.
2014-05-08 06:03:30 +00:00
nicm bec6c807cd There is no longer a need for a paste_stack struct or for global_buffers
to be global. Move to paste.c.
2014-04-24 09:14:43 +00:00
nicm 806520f025 Add some UTF-8 utility functions and use them to prevent the width limit
on formats from splitting UTF-8 characters improperly.
2014-04-17 15:37:55 +00:00
nicm 3e27be353d Set PATH explicitly, either from client or session
environment. Previously it came from the session environment. From J
Raynor.
2014-04-17 13:02:59 +00:00
nicm ada75af199 Don't limit the DCS buffer to 256 bytes, expand it as needed. Requested
by Suraj Kurapati.
2014-04-17 12:43:38 +00:00
nicm 2e98c9057d Correct the dance to fix the active pane in join-pane by pulling the
(right) code from break-pane and window_remove_pane into a helper
function.
2014-04-17 09:13:13 +00:00
nicm 2740490e27 Remove the "info" message mechanism, this was only used for about five
mostly useless and annoying messages. Change those commands to silence
on success like all the others. Still accept the -q command line flag
and "quiet" server option for now.
2014-04-17 07:55:43 +00:00
nicm 992ef70fb6 Remove the monitor-content option and associated bits and bobs. It's
never worked very well. If there is a big demand for it to return, will
consider better ways to do it.
2014-04-17 07:36:45 +00:00
nicm 871b83cbab Remove a leftover prototype and fix some spacing. 2014-04-16 21:16:19 +00:00
nicm 14a96df9ee Remove the choose-list command to prepare for some later choose-* work. 2014-04-16 21:02:41 +00:00
nicm acef311fe3 Work out mouse scroll wheel effect when the mouse is first detected and
store it in struct mouse_event, reduce the scroll size the 3 but allow
shift to reduce it to 1 and meta and ctrl to multiply by 3 if the
terminal supports them, also support wheel in choose mode. From Marcel
Partap.
2014-04-03 08:20:29 +00:00
nicm 252a7373d6 Support UTF-8 with choose-buffer, from Kosuke ASAMI. Also make
buffer_sample bigger to let it trim at window right edge.
2014-04-02 18:12:18 +00:00
deraadt d9960b2d4d missed commit matching log.c 2014-04-01 05:50:30 +00:00
nicm 7bdb675469 GRID_DEBUG is no longer needed. 2014-03-31 21:42:27 +00:00
nicm f155316be7 Remove unused log functions. 2014-03-31 21:42:05 +00:00
nicm 46593e7aa2 Add names for mouse button bits rather than using magic numbers, from
Marcel Partap.
2014-03-31 21:40:21 +00:00
nicm fcdae6925a Use hex constants rather than shifts for mouse events and flags, pointed
out by Marcel Partap.
2014-03-31 21:39:59 +00:00
nicm 0e4d1d8493 Add setb -a to append and a copy mode append command, from J Raynor with
minor changes.
2014-03-31 21:39:31 +00:00
nicm b11de5adc7 Make session_attached a count and add session_many_attached flag. 2014-03-31 21:37:55 +00:00
nicm 9368914ee7 Add start-of-list, end-of-list, top-line and bottom-line in choice mode,
from madmaverick9 at roxxmail dot eu, similar diff a few days later from
Marcel Partap.
2014-03-31 21:36:43 +00:00
nicm 175f215187 Having three *clock* files is ridiculous, remove clock.c. 2014-03-31 21:34:08 +00:00
nicm f1828921df Change terminal-overrides to a server option (now that we have them), it
doesn't make much sense as a session option.
2014-02-23 00:53:06 +00:00
nicm 9f02feb9d0 Break up and simplify screen_redraw_screen. 2014-01-31 14:19:24 +00:00
nicm 945339b443 Allow replacing each of the many sets of separate foo-{fg,bg,attr}
options with a single foo-style option. For example:

    set -g status-fg yellow
    set -g status-bg red
    set -g status-attr blink

Becomes:

    set -g status-style fg=yellow,bg=red,blink

The -a flag to set can be used to add to rather than replace a style. So:

    set -g status-bg red

Becomes:

    set -ag status-style bg=red

Currently this is fully backwards compatible (all *-{fg,bg,attr} options
remain) but the plan is to deprecate them over time.

From Tiago Cunha.
2014-01-28 23:07:09 +00:00
nicm c930fd5ff6 Remember the last active pane in the top-bottom or left-right cell so
that it can be restored when moving back to that cell with selectp
-L/-R/etc. From Suraj N Kurapati.
2014-01-28 22:19:17 +00:00
nicm 1a0d3cd5d3 Allow attach-session -t to accept a window and pane to select them on
attach. Based on a diff from J Raynor.
2014-01-09 14:20:55 +00:00
nicm 7fa55b0419 Key to swap to other end of selection (bound to o with vi keys), from J
Raynor.
2013-10-23 11:31:03 +00:00
nicm bf35441608 Do not run any command line command from the client which starts the
server until after the configuration file completes. This prevents it
racing against run-shell or if-shell in .tmux.conf that run in the
background.
2013-10-20 17:28:43 +00:00
nicm d0566a474a Remove the KERN_PROC_CWD the proc_current_path format (which is the only
thing that uses it now).
2013-10-10 12:39:24 +00:00
nicm c1ccefc62d We accidentally haven't been using $TMUX to work out the session for a
while and in fact it is less useful that using the client ttyname. So
don't bother and don't pass it from the client. If we need it in future
it is in c->environ.
2013-10-10 12:29:35 +00:00
nicm 282c5f9644 Alter how tmux handles the working directory to internally use file
descriptors rather than strings.

- Each session still has a current working directory.

- New sessions still get their working directory from the client that
  created them or its attached session if any.

- New windows are created by default in the session working directory.

- The -c flag to new, neww, splitw allows the working directory to be
  overridden.

- The -c flag to attach let's the session working directory be changed.

- The default-path option has been removed.

To get the equivalent to default-path '.', do:

        bind c neww -c $PWD

To get the equivalent of default-path '~', do:

        bind c neww -c ~

This also changes the client identify protocol to be a set of messages rather
than one as well as some other changes that should make it easier to make
backwards-compatible protocol changes in future.
2013-10-10 12:26:34 +00:00
nicm 10c38436aa Similarly for MSG_COMMAND - allow full imsg limit not arbitrary 2048. 2013-10-10 12:13:56 +00:00
nicm 6c093010e0 Remove CMD_SENDENVIRON. 2013-10-10 12:09:34 +00:00
nicm 4c9f41f1ad Pass flags into cmdq_guard as an argument since sometimes cmdq->cmd can
be NULL. Avoids crash when a command in a command client can't be
parsed.
2013-10-10 11:45:28 +00:00
Nicholas Marriott f884fff869 Implement s, S, C mode switch commands in vi(1) mode, from Ben Boeckel. 2013-07-05 14:38:23 +00:00
Nicholas Marriott 3977dba761 Focus events can cause trouble if left on and they can't be turned off
during idle periods (like the other states are) because we'd miss
events. So add a server option to control them. Defaults to off.
2013-06-23 13:10:46 +00:00
Nicholas Marriott 13441e8cb8 The actual terminfo entries we ended up with for cursor changes are Cs,
Ce, Ss and Se (not Cc, Ce, Cs, Csr). So use and document these instead
of the ones we were using earlier.
2013-06-02 07:52:15 +00:00
Nicholas Marriott a0cf65db77 Instead of eating 1024 bytes or so for the arguments of each command,
save memory by using an RB tree. From Tiago Cunha.
2013-05-31 12:19:34 +00:00
Nicholas Marriott e323101ede Rename global configuration define. 2013-04-24 10:01:32 +00:00
Nicholas Marriott 3d2b7d5bce When using choose-tree -u, start with the current window
highlighted. From Thomas Adam.
2013-04-22 22:17:29 +00:00
Nicholas Marriott 982354765b Remove tmux's (already minimal) 88 colour support. Such terminals are
few and unnecessary.
2013-03-27 11:17:12 +00:00
Nicholas Marriott 43fb9835fa Add -P and -F to new-session. 2013-03-25 11:44:00 +00:00
Nicholas Marriott 6fee3e9e4b Rename session idx to session id throughout and add $ prefix to targets
to use it, extended from a diff from George Nachman.
2013-03-25 10:11:45 +00:00
Nicholas Marriott 410a3abbef Add a wait-for command which blocks a client on a named channel until it
is woken up again (with wait-for -S). From Thiago Padilha.
2013-03-25 10:09:05 +00:00
Nicholas Marriott 14fad6a5cc Add -A flag to new-session to make it behave like attach-session if the
session exists. If -A is used, -D behaves like -d to attach-session.
2013-03-24 09:58:40 +00:00
Nicholas Marriott 20636d956d Add a command queue to standardize and simplify commands that call other
commands and allow a command to block execution of subsequent
commands. This allows run-shell and if-shell to be synchronous which has
been much requested.

Each client has a default command queue and commands are consumed one at
a time from it. A command may suspend execution from the queue by
returning CMD_RETURN_WAIT and then resume it by calling cmd_continue() -
for example run-shell does this from the callback that is fired after
the job is freed.

When the command queue becomes empty, command clients are automatically
exited (unless attaching). A callback is also fired - this is used for
nested commands in, for example, if-shell which can block execution of
the client's cmdq until a new cmdq becomes empty.

Also merge all the old error/info/print functions together and lose the
old curclient/cmdclient distinction - a cmdq is bound to one client (or
none if in the configuration file), this is a command client if
c->session is NULL otherwise an attached client.
2013-03-24 09:54:10 +00:00
Nicholas Marriott a60687f9ba Handle focus events from the terminal, from Aaron Jensen. 2013-03-24 09:28:59 +00:00
Nicholas Marriott eaaeb28cda Add session_set_current helper function, extracted from a diff from
Aaron Jensen.
2013-03-22 16:00:26 +00:00