Commit Graph

34 Commits

Author SHA1 Message Date
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
4f01bfc4bc Make choose-tree actually work again. 2013-02-15 12:57:13 +00:00
Nicholas Marriott
6e03b50771 Run session command before window in choose-tree. 2013-02-13 11:05:10 +00:00
Nicholas Marriott
544c80d715 Fix constness of cmd_template_replace. 2013-02-13 10:19:43 +00:00
Nicholas Marriott
36fe146a74 Fix choose-tree usage. 2013-02-13 09:55:37 +00:00
Nicholas Marriott
f1ce95915c Allow choose commands to be used outside tmux, so long as at least one client
is attached.
2013-02-10 17:52:51 +00:00
Nicholas Marriott
aadc87f5a7 Remove free callback for window_choose_data objects. 2013-02-10 17:36:58 +00:00
Nicholas Marriott
4d382ae8e6 Miscellaneous tidying of choose API, including:
- rename client and session to start_client and start_session in
  window_choose_data struct. also add TREE_OTHER define and reorder the
  struct
- rename window_choose_ctx to window_choose_data_run
- don't pass a cmd_ctx into window_choose_create (will let it use a
  different client later). instead take type, session, client
- add window_choose_data_free and use it to dispose of wcd rather than
  each cmd-*.c doing it individually
- change so ref counting is done by wcd_add and wcd_free rather than
  callers. this means 1 ref for each item but what of it :-)
- also add a ref to tree_session - not sure if this is needed?
- all the callbacks except choose-client and find-window are the same so
  remove them and add window_choose_default_callback
- reorder/rename some other bits and pieces for tidyness
2013-02-10 17:32:58 +00:00
Thomas Adam
2ca8b7f359 Merge branch 'obsd-master' 2013-01-17 22:14:18 +00:00
Nicholas Marriott
d31315884c Fix some blank line nits. 2013-01-17 03:51:21 +00:00
Thomas Adam
675c6b3773 Merge branch 'obsd-master'
Sync from OpenBSD.
2012-12-31 18:50:37 +00:00
Nicholas Marriott
b18ff67646 Add a -u flag to choose-tree to start uncollapsed, from Raghavendra D
Prabhu.
2012-12-24 12:25:52 +00:00
Nicholas Marriott
ce0b285aad Fix up missing bits. 2012-09-25 08:54:01 +01:00
Nicholas Marriott
eb0ad181e9 Use ACS characters for choose-tree arrows based on diff from Romain
Francoise.
2012-09-24 12:53:55 +00:00
Nicholas Marriott
a1cd0eee1b Use the right index when adding item in choose-tree, from Thomas Adam. 2012-09-04 22:37:31 +01:00
Nicholas Marriott
996a636713 Remove an unused variable. 2012-09-04 22:36:56 +01:00
Nicholas Marriott
0304555184 Change format of choose-tree arrows slightly, from Romain Francoise. 2012-09-04 22:35:52 +01:00
Nicholas Marriott
4f8a6867fa Use the right index when adding item in choose-tree, from Thomas Adam. 2012-09-03 12:24:25 +00:00
Nicholas Marriott
adc9fad4ac Remove an unused variable. 2012-09-03 09:36:07 +00:00
Nicholas Marriott
a679a4a708 Change format of choose-tree arrows slightly, from Romain Francoise. 2012-09-03 09:01:16 +00:00
Tiago Cunha
1c608031b5 Sync OpenBSD patchset 1162:
Use a separate define for each default format template and strip clutter
from the choose-tree defaults.
2012-08-31 09:18:50 +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
Tiago Cunha
45d68963ab Sync OpenBSD patchset 1157:
Fix a return type.
2012-08-12 19:29:05 +00:00
Nicholas Marriott
8889a48f9b Fix a return type. 2012-08-11 06:46:47 +00:00
Tiago Cunha
d697b5ef20 Sync OpenBSD patchset 1152:
Nuke unused variable from Thomas Adam.
2012-07-12 21:14:46 +00:00
Nicholas Marriott
35a8a61254 Nuke unused variable from Thomas Adam. 2012-07-12 13:03:42 +00:00
Tiago Cunha
1f5e6e35d5 Sync OpenBSD patchset 1151:
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 19:37:32 +00:00
Tiago Cunha
a432fcd306 Sync OpenBSD patchset 1150:
xfree is not particularly helpful, remove it. From Thomas Adam.
2012-07-11 19:34:16 +00:00
Tiago Cunha
188be9718e Sync OpenBSD patchset 1148:
Fix choose-tree usage string.
2012-07-11 17:16:25 +00:00
Tiago Cunha
a10143a2d1 Sync OpenBSD patchset 1146:
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-11 17:13:55 +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
91f54b59ac Fix choose-tree usage string. 2012-07-09 07:08:03 +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