Commit Graph

416 Commits (48478ea0a990cc14d61722f9f8d3f1490d8f417a)

Author SHA1 Message Date
Nicholas Marriott 47c097cb51 Support middle-click paste, based on a diff from Ailin Nemui. 2012-11-27 20:22:12 +00:00
Nicholas Marriott 24d7d073ff Support the 47 and 1047 SM and RM sequences (alternate screen without
cursor), requested by I forget who ages ago.
2012-11-27 20:08:42 +00:00
Nicholas Marriott 9b8998aeec Correctly aggregate together errors from nested config files (with
source-file). Fix by Thomas Adam, reported by Sam Livingstone-Gray
2012-11-27 16:12:29 +00:00
Nicholas Marriott 260419f48e Put helper function back, will be needed in a bit. 2012-11-22 14:41:11 +00:00
Nicholas Marriott 827b311c81 Use a utility function for common code to show errors in config file,
from Thomas Adam.
2012-11-19 10:38:06 +00:00
Nicholas Marriott c68efec6c0 Show last client activity time in default choose-client list. 2012-11-05 13:13:04 +00:00
Nicholas Marriott d210d99cce Make mouse event structure clearer by defining events (up, click, drag)
and simplifying how buttons and wheels are represented, from Ailin
Nemui. Should be no functional changes.
2012-10-26 14:35:42 +00:00
Nicholas Marriott 9107b0c69a Allow session tree (C-b s) to expand and collapse sessions with
left/right/space keys. From Thomas Adam.
2012-10-02 08:16:28 +00:00
Nicholas Marriott 17bbf90393 Add notification for input from a pane, from George Nachman. 2012-09-25 07:41:22 +00:00
Nicholas Marriott 84612a8196 Add control_write_buffer, from George Nachman. 2012-09-24 13:39:10 +00:00
Nicholas Marriott 42272dfbd5 Use pgrp of pty fd not pid of immediate child when recovering current
working directory (like current process). From Marcel Partap.
2012-09-24 13:05:10 +00:00
Nicholas Marriott 9e7bbc7281 When choosing a pane found by find-window, switch to that pane rather
than just the window. Also use a helper function for the inner loop.
2012-09-03 12:20:17 +00:00
Nicholas Marriott 7263fa36eb add cmd-choose-list to allow arbitrary options to be selected. From
Thomas Adam.
2012-09-03 09:57:57 +00:00
Nicholas Marriott 9247c90d69 Send notifications to control clients. Also don't redraw client when
suspended.
2012-09-03 09:32:38 +00:00
Nicholas Marriott 58e8e0eac8 Fix up window reference counting and don't crash if the rename timer
fires while the window is dead but still referenced. Fixes problem
reported by Michael Scholz.
2012-08-21 10:00:33 +00:00
Nicholas Marriott 73c6785538 Use a separate define for each default format template and strip clutter
from the choose-tree defaults.
2012-08-14 08:51:53 +00:00
Nicholas Marriott a3dec6bece Instead of numbering choose mode items 0-9a-z and then nothing, number
them all and if there are more than 10 use a prompt when 0-9 is
pressed. From Thomas Adam.
2012-08-11 06:45:33 +00:00
Nicholas Marriott 5385a9bb34 Add a queue of notifys and a way to turn them off and on (we do not want
notifys to happen during some commands). Based on code from George
Nachman.
2012-07-13 06:27:41 +00:00
Nicholas Marriott ede8312d59 Make command exec functions return an enum rather than -1/0/1 values and
add a new value to mean "leave client running but don't attach" to fix
problems with using some commands in a command sequence. Most of the
work by Thomas Adam, problem reported by "jspenguin" on SF bug 3535531.
2012-07-11 07:10:15 +00:00
Nicholas Marriott df912e3540 xfree is not particularly helpful, remove it. From Thomas Adam. 2012-07-10 11:53:01 +00:00
Nicholas Marriott f20c6fe009 Add choose-tree command to show windows and sessions in the same
list. Change choose-window and -session to use the same code. From
Thomas Adam.
2012-07-08 16:04:38 +00:00
Nicholas Marriott 63f5c38023 Clear flags across all sessions, from Thomas Adam. 2012-07-08 07:27:32 +00:00
Nicholas Marriott 67b926cf3c Provide common helper function for adding windows and sessions to choose
lists and expand %% in command before using it rather than at callback
time. From Thomas Adam.
2012-06-25 14:27:25 +00:00
Nicholas Marriott 5b6f78186c Clean up and simplify the choose mode code, from Thomas Adam. 2012-06-25 14:08:55 +00:00
Nicholas Marriott 2942eca895 Add a skeleton mode to tmux (called "control mode") that let's tmux
commands be sent and output received on stdout. This can be used to
integrate with other terminal emulators and should allow some other
things to be made simpler later. More to come so doesn't do much yet and
deliberately not documented.
2012-06-18 13:16:42 +00:00
Nicholas Marriott 1845800651 Strip layout from choose-windows again (leave in list-windows),
suggested by Romain Francoise, diff from Thomas Adam.
2012-05-28 07:59:07 +00:00
Nicholas Marriott 993f1b96a3 Fix client templates, from Romain Francoise. 2012-05-27 21:43:57 +00:00
Nicholas Marriott 196710e2d3 Simplify logging and just fprintf(stderr, ...) for early errors. 2012-05-25 08:28:10 +00:00
Nicholas Marriott 1f23f6d686 Use a predefined structure for not-space cells used to set attributes. 2012-05-23 19:19:40 +00:00
Nicholas Marriott 84c708f355 Store client in tty struct directly instead of using a callback function
pointer.
2012-05-22 14:32:28 +00:00
Nicholas Marriott fe4f00834d Store mouse data in tty structure not on the stack. 2012-05-22 14:11:30 +00:00
Nicholas Marriott ebf94bc9cb Switch all of the various choose- and list- commands over to the format
infrastructure, from Thomas Adam.
2012-05-22 11:35:37 +00:00
Nicholas Marriott 682884edc5 Add a helper function to send ready message. 2012-05-22 10:56:48 +00:00
Nicholas Marriott 2f93affb98 If there are any terminals with insert mode but not ich1, they can go
through the slow path. Tidies code slightly.
2012-05-22 09:36:12 +00:00
Nicholas Marriott 7a4679a17f Instead of passing stdin/stdout/stderr file descriptors over imsg and
handling them in the server, handle them in the client and pass buffers
over imsg. This is much tidier for some upcoming changes and the
performance hit isn't critical.

The tty fd is still passed to the server as before.

This bumps the tmux protocol version so new clients and old servers are
incompatible.
2012-05-21 18:27:42 +00:00
Nicholas Marriott 37f9bb46d8 Add a helper function to open the terminal for attach-/new-session. 2012-05-06 07:38:17 +00:00
Nicholas Marriott a6c22d650b Add a flag to move-window to renumber the windows in a session (closing
any gaps) and add an option to do this automatically each time a window
is killed. From Thomas Adam.
2012-04-29 17:20:01 +00:00
Nicholas Marriott ff5155f719 Add a buffer with all input from last ground state, will be used for
control mode. From George Nachman.
2012-04-25 21:12:49 +00:00
Nicholas Marriott 6703ca8d26 Stop accepting new clients for 1 second on EMFILE/ENFILE. Based on
ongoing fixes to other daemons by Theo.
2012-04-11 06:16:14 +00:00
Nicholas Marriott ed54f01d2f Fix comment for mouse bits. 2012-04-01 21:45:48 +00:00
Nicholas Marriott 85f5485cb5 Add a layout history which can be stepped through with select-layout -u
and -U commands (bound to 'u' and 'U' by default).
2012-04-01 13:18:38 +00:00
Nicholas Marriott f59971276a Add a simple form of output rate limiting by counting the number of
certain C0 sequences (linefeeds, backspaces, carriage returns) and if it
exceeds a threshold (current default 50/millisecond), start to redraw
the pane every 100 milliseconds instead of making each change as it
comes. Two configuration options - c0-change-trigger and
c0-change-interval.

This makes tmux much more responsive under very fast output (for example
yes(1) or accidentally cat'ing a large file) but may not be perfect on
all terminals and connections - feedback very welcome, particularly
where this change has a negative rather than positive effect (making it
off by default is a possibility).

After much experimentation based originally on a request Robin Lee
Powell (which ended with a completely different solution), this idea
from discussion with Ailin Nemui.
2012-03-20 11:01:00 +00:00
Nicholas Marriott d8805af66b On xterm 271 and later, put the terminal into SCL 5 and use DECCRA for
scrolling the region in panes (if the large region check isn't
hit). With help from Ailin Nemui.
2012-03-17 22:56:04 +00:00
Nicholas Marriott 46210344a6 Add notify hooks for various events, the functions are currently empty
stubs but will be filled in for control mode later. From George Nachman.
2012-03-17 22:35:09 +00:00
Nicholas Marriott 889fe42e11 Break out termios initialization into a separate function, from George
Nachman.
2012-03-17 21:27:51 +00:00
Nicholas Marriott c8c0d68128 Send secondary DA to terminals with XT in terminfo when starting up and
parse it to work out the xterm version.
2012-03-15 10:36:00 +00:00
Nicholas Marriott 799f437eff Remove some bits leftover from unused backoff code. 2012-03-09 21:42:13 +00:00
Nicholas Marriott ac9ebc29a2 Use a lock file and flock() to serialize server start, avoids problems
when running a bunch of tmux from cron at the same time. Based on a diff
from Tim Ruehsen.
2012-03-09 09:57:40 +00:00
Nicholas Marriott 30f4c30ca3 Add A and I keys for vi status line editing. 2012-03-04 07:38:11 +00:00
Nicholas Marriott f4fdddc930 Support "bracketed paste" mode. This adds a -p flag to paste-buffer - if
this is used and the application has requested bracketed pastes, then
tmux surrounds the pasted text by \033[200~ and \033[201~. Applications
like vim can (apparently) use this to avoid, for example, indenting the
text. From Ailin Nemui.
2012-03-03 09:43:22 +00:00
Nicholas Marriott 4b8bb7770f The wlmouse offset should be part of the client, not the server. From
Ailin Nemui.
2012-03-03 08:55:56 +00:00
Nicholas Marriott 07ac16807f Add move-pane command (like join-pane but allows the same window). Also
-b flag to join-pane and move-pane to place the pane to the left or
above. From George Nachman.
2012-03-03 08:31:18 +00:00
Nicholas Marriott 4d9ccd3229 Add printf attribute to a couple of functions, from Tim Ruehsen. 2012-03-02 11:16:44 +00:00
Nicholas Marriott 4e7de210e4 Allow a single option to be specified to show-options to show just that
option.
2012-02-25 12:57:42 +00:00
Nicholas Marriott fddbd44c18 Add a wrapper function tty_set_size from George Nachman. 2012-02-15 17:25:02 +00:00
Nicholas Marriott 8363d19307 Move window name changes into wrapper function window_set_name, from
George Nachman.
2012-02-02 00:10:11 +00:00
Nicholas Marriott 908a22e41c Provide defined ways to set the various default-path possibilities: ~
for home directory, . for server start directory, - for session start
directory and empty for the pane's working directory (the default). All
can also be used as part of a relative path (eg -/foo). Also provide -c
flags to neww and splitw to override default-path setting.

Based on a diff from sthen. ok sthen
2012-01-31 15:52:21 +00:00
Nicholas Marriott 0e59bc75fd Give each window a unique id, like panes but prefixed with @. Based on
work from George Nachman.
2012-01-30 09:39:34 +00:00
Nicholas Marriott 230d0fbc9e Add an option to move the status line to the top of the screen,
requested by many.
2012-01-29 09:37:02 +00:00
Nicholas Marriott 678e67437f Remove unused backoff code that doesn't do any good. 2012-01-21 23:51:34 +00:00
Nicholas Marriott 8ed9124f3f Use RB trees not SPLAY. 2012-01-21 11:12:13 +00:00
Nicholas Marriott 535286c05a Drop the ability to have a list of keys in the prefix in favour of two
separate options, prefix and prefix2. This simplifies the code and gets
rid the data options type which was only used for this one option.

Also add a -2 flag to send-prefix to send the secondary prefix key,
fixing a cause of minor irritation.

People who want three prefix keys are out of luck :-).
2012-01-21 08:40:09 +00:00
Nicholas Marriott 66f04514cf Add a -R flag to send-keys to reset the terminal. Written ages ago and
Suggested by someone, I forget who.
2012-01-21 08:10:21 +00:00
Nicholas Marriott 8332413305 Add some const and fix a warning. 2012-01-20 19:54:07 +00:00
Nicholas Marriott e6519d3e27 Add space movement keys for vi mode in the status line from Ben Boeckel. 2012-01-20 19:10:29 +00:00
Nicholas Marriott f308ba93aa Change the way the working directory for new processes is discovered. If
default-path isn't empty, it is used. Otherwise:

1) If tmux neww is run from the command line, the working directory of the
   client is used.

2) Otherwise sysctl KERN_PROC_CWD is used to retrieve the current
   working directory of the process in the active pane.

3) If that fails, the directory where the session was created is used.

Support code by Romain Francois, OpenBSD specific bits by me.

Note this requires a recent userland and kernel with KERN_PROC_CWD.
2011-12-09 16:28:18 +00:00
Nicholas Marriott e04d13f6a6 Support "jump to" like vi in copy mode using t and T keys. Also add x
and X for delete in edit mode.

From Ben Boeckel, thanks.
2011-12-04 16:18:01 +00:00
Nicholas Marriott fc5f8804ec Add word movement and editing command for command prompt editing, from
Ben Boeckel.
2011-11-15 23:34:12 +00:00
Nicholas Marriott 57df442916 Make window_pane_index work the same as window_index, from Ben Boeckel. 2011-11-15 23:19:51 +00:00
Nicholas Marriott f0aad68aee Support for \e[3J to clear the history. Also send the corresponding
terminfo code (E3) before locking.
2011-10-23 10:16:14 +00:00
Nicholas Marriott 7ff4cf9405 Try to resolve relative paths for loadb and saveb (first using client
working directory if any then default-path or session wd).
2011-10-23 08:34:01 +00:00
Nicholas Marriott 16d75a6bf2 Add client formats, from Ben Boeckel. 2011-10-23 01:12:46 +00:00
Nicholas Marriott 4a5dff3f11 Add initial framework for more powerful formatting of command output and
use it for list-{panes,windows,sessions}. This allows more descriptive
replacements (such as #{session_name}) and conditionals.

Later this will be used for status_replace and list-keys and other
places.
2011-08-26 10:53:16 +00:00
Nicholas Marriott 029c34ce6b Add a tty_bell wrapper function, from Dylan Alex Simon. 2011-08-24 09:58:44 +00:00
Nicholas Marriott ad60a2c952 Allow the initial context on prompts to be set with the new -I option to
command-prompt. From Tiago Cunha.
2011-07-02 21:05:44 +00:00
Nicholas Marriott 1202284f37 PANE_FREEZE doesn't do anything anymore, so remove it. 2011-06-27 00:04:49 +00:00
Nicholas Marriott 65177b82be Add a respawn-pane command, from Marcel Partap. 2011-06-05 11:19:03 +00:00
Nicholas Marriott 2b60c648c4 Get rid of the layout string code which tries to walk through the layout
hierarchy and instead just look at what panes are actually in the window.
2011-06-05 10:53:05 +00:00
Nicholas Marriott 3ea5e06bfb Support DECSCUSR sequence to set the cursor style with two new
terminfo(5) extensions, Cs and Csr. Written by Ailin Nemui.
2011-05-20 19:17:39 +00:00
Nicholas Marriott 944b5e6fa0 Support xterm(1) cursor colour change sequences through terminfo(5) Cc
(set) and Cr (reset) extensions. Originally by Sean Estabrooks, tweaked
by me and Ailin Nemui.
2011-05-20 19:03:58 +00:00
Nicholas Marriott 96e7f33da3 Support setting the xterm clipboard when copying from copy mode using
the xterm escape sequence for the purpose (if xterm is configured to
allow it).

Written by and much discussed Ailin Nemui, guidance on
xterm/termcap/terminfo from Thomas Dickey.
2011-05-18 20:24:29 +00:00
Nicholas Marriott 58908fd8c5 Add three new copy-mode commands - select-line, copy-line,
copy-end-of-line. From Dave Disser and Randy Stauner a while back.
2011-05-18 18:06:36 +00:00
Nicholas Marriott f3741f0653 Add a new option, mouse-resize-pane. When on, panes may be resized by
dragging their borders. From hsim at gmx.li.
2011-05-08 20:34:12 +00:00
Nicholas Marriott 295ace6820 Use the tsl and fsl terminfo(5) capabilities to update terminal title
and automatically fill them in on terminals with the XT capability
(which means their title setting is xterm-compatible). From hsim at
gmx.li.
2011-05-08 19:53:06 +00:00
Nicholas Marriott 8738141913 When mode-mouse is on (it is off by default), automatically enter copy
mode when the mouse is dragged or the mouse wheel is used. Also exit
copy mode when the mouse wheel is scrolled off the bottom. Discussed
with and written by hsim at gmx dot li.
2011-04-19 21:31:33 +00:00
Nicholas Marriott 0bb2119781 Add an option (mouse-select-window) which allows the mouse to be used by
clicking on the status line, written by hsim at gmx dot li.
2011-04-18 19:49:05 +00:00
Nicholas Marriott 0a09d04e1b If the terminal supports sitm for italics, use it instead of standout
(smso). From Tiago Resende.
2011-04-09 07:48:08 +00:00
Nicholas Marriott ec89eb9552 Change so that an empty session name always means the current sessions
even if given with, for example, -t '', and explicitly forbid empty
session names and those containing a : when they are created.
2011-04-06 21:51:31 +00:00
Nicholas Marriott 5d519ba526 Add a flag to cmd_find_session so that attach-session can prefer
unattached sessions when choosing the most recently used (if -t is not
given). Suggested by claudio@.
2011-04-05 19:37:01 +00:00
Nicholas Marriott d88c20e718 Change -t on display-message to be target-pane for the #[A-Z]
replacements and add -c as target-client.
2011-03-29 19:30:16 +00:00
Nicholas Marriott fa6abac98d Style: uint -> u_int and a missing else. 2011-03-28 19:44:31 +00:00
Nicholas Marriott 7ce8fee4f3 Don't include meta twice when working out the flags to output for
xterm-style keys - bit 3 is accepted on input but not on output. Also a
style nit in the header.
2011-03-27 20:31:25 +00:00
Nicholas Marriott 808502ac3d Give each pane created in a tmux server a unique id (starting from 0),
put it in the TMUX_PANE environment variable and accept it as a
target. Suggested by and with testing and tweaks from Ben Boeckel.
2011-03-27 20:27:26 +00:00
Nicholas Marriott 79e30daeae Support passing through escape sequences to the underlying terminal by
using DCS with a "tmux;" prefix. Escape characters in the sequences must
be doubled. For example:

$ printf '\033Ptmux;\033\033]12;red\007\033\\'

Will pass \033]12;red\007 to the terminal (and change the cursor colour
in xterm). From Kevin Goodsell.
2011-03-07 23:46:27 +00:00
Nicholas Marriott 7954126dcd Add a -P option to detach to HUP the client's parent process (usually
causing it to exit as well).
2011-03-03 08:51:47 +00:00
Nicholas Marriott db7a89b1ee Simplify the way jobs work and drop the persist type, so all jobs are
fire-and-forget.

Status jobs now managed with two trees of output (new and old), rather
than storing the output in the jobs themselves. When the status line is
processed any jobs which don't appear in the new tree are started and
the output from the old tree displayed. When a job finishes it updates
the new tree with its output and that is used for any subsequent
redraws. When the status interval expires, the new tree is moved to the
old so that all jobs are run again.

This fixes the "#(echo %H:%M:%S)" problem which would lead to thousands
of identical persistent jobs and high memory use (this can still be
achieved by adding "sleep 30" but that is much less likely to happen by
accident).
2011-01-26 01:54:56 +00:00
Nicholas Marriott 4dfb29fa38 Use LIST_* not SLIST_*. 2011-01-26 00:11:47 +00:00
Nicholas Marriott ecc22c521d When clearing the entire screen, clear lines that are used into the
history like xterm does. Requested ages ago by someone I've forgotten.
2011-01-25 23:40:26 +00:00
Nicholas Marriott 1270f8fed8 Check if the index is in use and fail before creating the child process,
rather than leaving a stray child on failure.
2011-01-25 22:31:50 +00:00
Nicholas Marriott b8023044c3 Set $TMUX without the session when background jobs are run. 2011-01-23 11:03:43 +00:00