Commit Graph

291 Commits

Author SHA1 Message Date
Thomas Adam
a77355b6bf Merge branch 'obsd-master' 2014-10-16 16:46:31 +01:00
nicm
a27ba6e380 Add xreallocarray and remove nmemb argument from xrealloc. 2014-10-08 17:35:58 +00:00
nicm
a54b0055f6 Support using pane id as part of session or window specifier (so %1
means session-of-%1 or window-of-%1) and window id as part of session
(so @1 means session-of-@1).
2014-09-25 12:51:40 +00:00
nicm
304f86cdbb Support ! for last pane. 2014-09-25 12:45:35 +00:00
Thomas Adam
a131b82e95 Merge branch 'obsd-master'
Conflicts:
	client.c
2014-08-09 20:31:36 +01:00
nicm
c5253ad8f7 Show an error if cmd_find_session can't find the current session, like
the other functions.
2014-07-13 20:57:46 +00:00
Thomas Adam
bae95844d7 Merge branch 'obsd-master'
Conflicts:
	format.c
	window.c
2014-05-13 21:58:48 +01: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
f4ffaf5a7f Just use char ** for argv like normal people, not char *const *. 2014-05-09 09:11:24 +00:00
Thomas Adam
953c3ef47a Merge branch 'obsd-master'
Conflicts:
	Makefile
	tmux.1
	window.c
2014-04-23 11:26:11 +01:00
nicm
14a96df9ee Remove the choose-list command to prepare for some later choose-* work. 2014-04-16 21:02:41 +00:00
nicm
18cb135218 Don't write into buffer if no arguments, reported by Filipe Rosset. 2014-03-31 21:32:31 +00:00
Nicholas Marriott
0bb9d51965 Don't write into buffer if no arguments, reported by Filipe Rosset. 2014-02-26 21:42:59 +00:00
Thomas
d02c4bda3a Merge branch 'obsd-master' 2014-01-20 10:48:12 +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
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
6ac7abe8f0 Remove now unused cmd_get_default_path. 2013-10-10 12:28:56 +00:00
nicm
b822d24b15 Support -c for new-session, based on code from J Raynor. 2013-10-10 12:07:36 +00:00
Nicholas Marriott
e9b09faab2 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-06 22:38:33 +01:00
Nicholas Marriott
5ea6148362 Remove now unused cmd_get_default_path. 2013-10-06 21:35:44 +01:00
Nicholas Marriott
9389cfbec9 Support -c for new-session, based on code from J Raynor. 2013-10-01 23:48:03 +01:00
Nicholas Marriott
a36da3a878 Remove the barely-used and unnecessary command check() function. 2013-08-21 18:01:40 +01:00
Thomas Adam
76cb088d16 Merge branch 'obsd-master'
Conflicts:
	tmux.h
2013-05-25 11:48:12 +01:00
Nicholas Marriott
25c430b1cd Reserve space for \0 in cmd_print, from George Nachman. 2013-05-15 15:34:09 +00:00
Nicholas Marriott
b5fda7ad2a Spacing, warning nits. 2013-03-25 12:00:30 +00:00
Nicholas Marriott
673eb160d4 Sort includes and fix spaces. 2013-03-25 11:53:54 +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
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
bb8457b166 Fix error reporting for client commands by adding a flag to
cmd_find_client to tell it whether or not to show errors, sometimes it's
needed and sometimes not.
2013-03-24 09:27:19 +00:00
Nicholas Marriott
2243cfbe75 Need to set clients in context before changing their reference count. 2013-03-22 15:54:29 +00:00
Nicholas Marriott
d1e6ce2672 Add functions to allocate and free command contexts rather than doing it
all on the stack.
2013-03-22 15:49:55 +00:00
Nicholas Marriott
51d989f5df Do not crash when calling choose-tree with a command that changes the mode. 2013-03-21 16:22:48 +00:00
Nicholas Marriott
f47a063841 Rename session idx to session id throughout and add $ prefix to targets to use
it, extended from a diff from George Nachman.
2013-03-07 10:07:22 +00:00
Nicholas Marriott
7fd4d49d56 Add a wait-for command which blocks a client on a named channel until it is
wokrn up again (with wait-for -S). From Thiago Padilha.
2013-03-06 09:57:26 +00:00
Nicholas Marriott
43d904dbf3 tty.path can be NULL, don't dereference it. From George Nachman. 2013-03-04 09:02:32 +00:00
Nicholas Marriott
3964309c67 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-02-23 22:25:58 +00:00
Nicholas Marriott
3a2e9d805a Fix error reporting for client commands by adding a flag to cmd_find_client to
tell it whether or not to show errors, sometimes it's needed and sometimes not.
2013-02-22 23:04:53 +00:00
Nicholas Marriott
afd5e978cf Need to set clients in context before changing their reference count. 2013-02-20 10:25:15 +00:00
Nicholas Marriott
293e331d69 Add functions to allocate and free command contexts rather than doing it all on
the stack.
2013-02-18 23:20:21 +00:00
Nicholas Marriott
362c460767 Do not crash when calling choose-tree with a command that changes the mode. 2013-02-13 11:01:26 +00:00
Nicholas Marriott
f4c815a1d9 Fix constness again, sigh. 2013-02-13 10:41:12 +00:00
Nicholas Marriott
544c80d715 Fix constness of cmd_template_replace. 2013-02-13 10:19:43 +00:00
Thomas Adam
a3f4eb7b24 Merge branch 'obsd-master'
Conflicts:
	Makefile
	grid-utf8.c
2013-01-30 15:27:19 +00:00
Nicholas Marriott
c2e2107063 Style nits - return (x) not return x. 2013-01-18 02:10:29 +00:00
Thomas Adam
675c6b3773 Merge branch 'obsd-master'
Sync from OpenBSD.
2012-12-31 18:50:37 +00:00
Nicholas Marriott
854e8ae04d Add ^ and $ special command targets to select lowest and highest
numbered windows, from Raghavendra D Prabhu.
2012-12-24 12:38:57 +00:00
Thomas Adam
39631edb98 Merge branch 'obsd-master'
Sync from OpenBSD.
2012-11-27 18:12:04 +00:00
Nicholas Marriott
991bfcf443 Fix session choice so that preferring unattached sessions actually
works, reported by Drew Frank.
2012-11-27 09:20:03 +00:00
Nicholas Marriott
5d60bc7f7c Use pgrp of pty fd not pid of immediate child when recovering current working
directory (like current process). From Marcel Partap.
2012-09-24 14:05:38 +01:00