The branch, hooks has been updated
via 9f8a1ecd8a1117ae4eb00ce790c468e872e480d5 (commit)
from 0a41cf949427e07c01f71de8b135a4133fbded15 (commit)
- Log -----------------------------------------------------------------
commit 9f8a1ecd8a1117ae4eb00ce790c468e872e480d5
Author: Nicholas Marriott <[email protected]>
Commit: Nicholas Marriott <[email protected]>
Put changes back I think.
---
cmd-attach-session.c | 5 +----
cmd-bind-key.c | 3 +--
cmd-break-pane.c | 3 +--
cmd-capture-pane.c | 3 +--
cmd-choose-buffer.c | 3 +--
cmd-choose-client.c | 4 +---
cmd-choose-tree.c | 9 +++------
cmd-clear-history.c | 4 +---
cmd-clock-mode.c | 3 +--
cmd-command-prompt.c | 3 +--
cmd-confirm-before.c | 3 +--
cmd-copy-mode.c | 3 +--
cmd-delete-buffer.c | 3 +--
cmd-detach-client.c | 20 +++-----------------
cmd-display-message.c | 27 +++------------------------
cmd-display-panes.c | 3 +--
cmd-find-window.c | 3 +--
cmd-has-session.c | 3 +--
cmd-if-shell.c | 20 +++-----------------
cmd-join-pane.c | 22 ++++------------------
cmd-kill-pane.c | 4 +---
cmd-kill-server.c | 6 ++----
cmd-kill-session.c | 4 +---
cmd-kill-window.c | 8 +++-----
cmd-list-buffers.c | 3 +--
cmd-list-clients.c | 3 +--
cmd-list-keys.c | 3 +--
cmd-list-panes.c | 19 ++-----------------
cmd-list-sessions.c | 3 +--
cmd-list-windows.c | 13 +------------
cmd-load-buffer.c | 3 +--
cmd-lock-server.c | 23 ++++-------------------
cmd-move-window.c | 24 +++---------------------
cmd-new-session.c | 17 +++++++----------
cmd-new-window.c | 22 ++++------------------
cmd-paste-buffer.c | 3 +--
cmd-pipe-pane.c | 3 +--
cmd-queue.c | 3 ++-
cmd-refresh-client.c | 3 +--
cmd-rename-session.c | 4 +---
cmd-rename-window.c | 4 +---
cmd-resize-pane.c | 3 +--
cmd-respawn-pane.c | 3 +--
cmd-respawn-window.c | 3 +--
cmd-rotate-window.c | 3 +--
cmd-run-shell.c | 3 +--
cmd-save-buffer.c | 6 ++----
cmd-select-layout.c | 9 +++------
cmd-select-pane.c | 20 ++------------------
cmd-select-window.c | 36 ++++--------------------------------
cmd-send-keys.c | 7 ++-----
cmd-set-buffer.c | 3 +--
cmd-set-environment.c | 4 +---
cmd-set-hook.c | 4 +---
cmd-set-option.c | 6 ++----
cmd-show-environment.c | 3 +--
cmd-show-hooks.c | 3 +--
cmd-show-messages.c | 6 ++----
cmd-show-options.c | 22 +++-------------------
cmd-source-file.c | 3 +--
cmd-split-window.c | 3 +--
cmd-swap-pane.c | 3 +--
cmd-swap-window.c | 16 +---------------
cmd-switch-client.c | 17 +++--------------
cmd-unbind-key.c | 3 +--
cmd-wait-for.c | 3 +--
cmd.c | 10 +++++++---
tmux.h | 14 ++++++--------
68 files changed, 123 insertions(+), 415 deletions(-)
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index 6a469a9..7dbf503 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -31,15 +31,13 @@
*/
enum cmd_retval cmd_attach_session_exec(struct cmd *, struct cmd_q *);
-void cmd_attach_session_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_attach_session_entry = {
"attach-session", "attach",
"c:drt:", 0, 0,
"[-dr] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
CMD_CANTNEST|CMD_STARTSERVER|CMD_PREPARESESSION,
- cmd_attach_session_exec,
- NULL
+ cmd_attach_session_exec
};
enum cmd_retval
@@ -78,7 +76,6 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int
dflag, int rflag,
if (w != NULL)
wl = winlink_find_by_window(&s->windows, w);
}
- /* TA: Likely broken! */
if ((s = cmdq->state.s) == NULL)
return (CMD_RETURN_ERROR);
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index 6eda84d..5d68d48 100644
--- a/cmd-bind-key.c
+++ b/cmd-bind-key.c
@@ -36,8 +36,7 @@ const struct cmd_entry cmd_bind_key_entry = {
"cnrt:", 1, -1,
"[-cnr] [-t mode-table] key command [arguments]",
0,
- cmd_bind_key_exec,
- NULL
+ cmd_bind_key_exec
};
enum cmd_retval
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index c2f2ea1..db59869 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -35,8 +35,7 @@ const struct cmd_entry cmd_break_pane_entry = {
"dPF:t:", 0, 0,
"[-dP] [-F format] " CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_break_pane_exec,
- NULL
+ cmd_break_pane_exec
};
enum cmd_retval
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index 74a2dc1..dade852 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -41,8 +41,7 @@ const struct cmd_entry cmd_capture_pane_entry = {
"[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] [-S start-line]"
CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_capture_pane_exec,
- NULL
+ cmd_capture_pane_exec
};
char *
diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c
index 674ad82..86d82d7 100644
--- a/cmd-choose-buffer.c
+++ b/cmd-choose-buffer.c
@@ -37,8 +37,7 @@ const struct cmd_entry cmd_choose_buffer_entry = {
"F:t:", 0, 1,
CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
CMD_PREPAREWINDOW,
- cmd_choose_buffer_exec,
- NULL
+ cmd_choose_buffer_exec
};
enum cmd_retval
diff --git a/cmd-choose-client.c b/cmd-choose-client.c
index f3237b2..5f3368d 100644
--- a/cmd-choose-client.c
+++ b/cmd-choose-client.c
@@ -34,7 +34,6 @@
"(last used #{client_activity_string})"
enum cmd_retval cmd_choose_client_exec(struct cmd *, struct cmd_q *);
-void cmd_choose_client_prepare(struct cmd *, struct cmd_q *);
void cmd_choose_client_callback(struct window_choose_data *);
@@ -43,8 +42,7 @@ const struct cmd_entry cmd_choose_client_entry = {
"F:t:", 0, 1,
CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
CMD_PREPAREWINDOW,
- cmd_choose_client_exec,
- NULL
+ cmd_choose_client_exec
};
struct cmd_choose_client_data {
diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c
index 4be9f6c..9de3cc2 100644
--- a/cmd-choose-tree.c
+++ b/cmd-choose-tree.c
@@ -49,8 +49,7 @@ const struct cmd_entry cmd_choose_tree_entry = {
"[-suw] [-b session-template] [-c window template] [-S format] " \
"[-W format] " CMD_TARGET_WINDOW_USAGE,
CMD_PREPAREWINDOW,
- cmd_choose_tree_exec,
- NULL
+ cmd_choose_tree_exec
};
const struct cmd_entry cmd_choose_session_entry = {
@@ -58,8 +57,7 @@ const struct cmd_entry cmd_choose_session_entry = {
"F:t:", 0, 1,
CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
CMD_PREPAREWINDOW,
- cmd_choose_tree_exec,
- NULL
+ cmd_choose_tree_exec
};
const struct cmd_entry cmd_choose_window_entry = {
@@ -67,8 +65,7 @@ const struct cmd_entry cmd_choose_window_entry = {
"F:t:", 0, 1,
CMD_TARGET_WINDOW_USAGE "[-F format] [template]",
CMD_PREPAREWINDOW,
- cmd_choose_tree_exec,
- NULL
+ cmd_choose_tree_exec
};
enum cmd_retval
diff --git a/cmd-clear-history.c b/cmd-clear-history.c
index e345238..0a9b3bb 100644
--- a/cmd-clear-history.c
+++ b/cmd-clear-history.c
@@ -25,15 +25,13 @@
*/
enum cmd_retval cmd_clear_history_exec(struct cmd *, struct cmd_q *);
-void cmd_clear_history_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_clear_history_entry = {
"clear-history", "clearhist",
"t:", 0, 0,
CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_clear_history_exec,
- NULL
+ cmd_clear_history_exec
};
enum cmd_retval
diff --git a/cmd-clock-mode.c b/cmd-clock-mode.c
index 32e8d47..95e1a61 100644
--- a/cmd-clock-mode.c
+++ b/cmd-clock-mode.c
@@ -31,8 +31,7 @@ const struct cmd_entry cmd_clock_mode_entry = {
"t:", 0, 0,
CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_clock_mode_exec,
- NULL
+ cmd_clock_mode_exec
};
enum cmd_retval
diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c
index 7f66fc4..8173e60 100644
--- a/cmd-command-prompt.c
+++ b/cmd-command-prompt.c
@@ -39,8 +39,7 @@ const struct cmd_entry cmd_command_prompt_entry = {
"I:p:t:", 0, 1,
"[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]",
CMD_PREPARECLIENT,
- cmd_command_prompt_exec,
- NULL
+ cmd_command_prompt_exec
};
struct cmd_command_prompt_cdata {
diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c
index d5ecd8b..beb91f3 100644
--- a/cmd-confirm-before.c
+++ b/cmd-confirm-before.c
@@ -38,8 +38,7 @@ const struct cmd_entry cmd_confirm_before_entry = {
"p:t:", 1, 1,
"[-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
CMD_PREPARECLIENT,
- cmd_confirm_before_exec,
- NULL
+ cmd_confirm_before_exec
};
struct cmd_confirm_before_data {
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index c06967d..0f8f47a 100644
--- a/cmd-copy-mode.c
+++ b/cmd-copy-mode.c
@@ -31,8 +31,7 @@ const struct cmd_entry cmd_copy_mode_entry = {
"t:u", 0, 0,
"[-u] " CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_copy_mode_exec,
- NULL
+ cmd_copy_mode_exec
};
enum cmd_retval
diff --git a/cmd-delete-buffer.c b/cmd-delete-buffer.c
index a7a6dc7..42268b7 100644
--- a/cmd-delete-buffer.c
+++ b/cmd-delete-buffer.c
@@ -33,8 +33,7 @@ const struct cmd_entry cmd_delete_buffer_entry = {
"b:", 0, 0,
CMD_BUFFER_USAGE,
0,
- cmd_delete_buffer_exec,
- NULL
+ cmd_delete_buffer_exec
};
enum cmd_retval
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index cd11542..68e3a07 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -27,15 +27,13 @@
*/
enum cmd_retval cmd_detach_client_exec(struct cmd *, struct cmd_q *);
-void cmd_detach_client_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_detach_client_entry = {
"detach-client", "detach",
"as:t:P", 0, 0,
"[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE,
CMD_READONLY|CMD_PREPARECLIENT|CMD_PREPARESESSION,
- cmd_detach_client_exec,
- cmd_detach_client_prepare
+ cmd_detach_client_exec
};
const struct cmd_entry cmd_suspend_client_entry = {
@@ -43,21 +41,9 @@ const struct cmd_entry cmd_suspend_client_entry = {
"t:", 0, 0,
CMD_TARGET_CLIENT_USAGE,
CMD_PREPARECLIENT,
- cmd_detach_client_exec,
- cmd_detach_client_prepare
+ cmd_detach_client_exec
};
-void
-cmd_detach_client_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (args_has(args, 's'))
- cmdq->state.s = cmd_find_session(cmdq, args_get(args, 's'), 0);
- else
- cmdq->state.c = cmd_find_client(cmdq, args_get(args, 't'), 0);
-}
-
enum cmd_retval
cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
{
@@ -82,7 +68,7 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
msgtype = MSG_DETACH;
if (args_has(args, 's')) {
- if ((s = cmdq->state.s) == NULL)
+ if ((s = cmd_find_session(cmdq, args_get(args, 's'), 0)) ==
NULL)
return (CMD_RETURN_ERROR);
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
diff --git a/cmd-display-message.c b/cmd-display-message.c
index 226d159..260a4e5 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -33,7 +33,6 @@
"- (%H:%M %d-%b-%y)"
enum cmd_retval cmd_display_message_exec(struct cmd *, struct cmd_q *);
-void cmd_display_message_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_display_message_entry = {
"display-message", "display",
@@ -41,29 +40,9 @@ const struct cmd_entry cmd_display_message_entry = {
"[-p] [-c target-client] [-F format] " CMD_TARGET_PANE_USAGE
" [message]",
CMD_PREPAREWINDOW|CMD_PREPARECLIENT,
- cmd_display_message_exec,
- cmd_display_message_prepare
+ cmd_display_message_exec
};
-void
-cmd_display_message_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (args_has(args, 't')) {
- cmdq->state.wl = cmd_find_pane(cmdq, args_get(args, 't'),
- &cmdq->state.s, &cmdq->state.wp);
- } else {
- cmdq->state.wl = cmd_find_pane(cmdq, NULL, &cmdq->state.s,
- &cmdq->state.wp);
- }
-
- if (args_has(args, 'c'))
- cmdq->state.c = cmd_find_client(cmdq, args_get(args, 'c'), 0);
- else
- cmdq->state.c = cmd_current_client(cmdq);
-}
-
enum cmd_retval
cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
{
@@ -82,6 +61,7 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
if ((wl = cmdq->state.wl) == NULL)
return (CMD_RETURN_ERROR);
+ c = cmd_current_client(cmdq);
wp = cmdq->state.wp;
s = cmdq->state.s;
@@ -90,9 +70,8 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq)
return (CMD_RETURN_ERROR);
}
- c = cmdq->state.c;
if (args_has(args, 'c')) {
- if (c == NULL)
+ if ((c = cmd_find_client(cmdq, args_get(args, 'c'), 0)) == NULL)
return (CMD_RETURN_ERROR);
} else {
if (c == NULL && !args_has(self->args, 'p')) {
diff --git a/cmd-display-panes.c b/cmd-display-panes.c
index 8b9cf58..ae11429 100644
--- a/cmd-display-panes.c
+++ b/cmd-display-panes.c
@@ -31,8 +31,7 @@ const struct cmd_entry cmd_display_panes_entry = {
"t:", 0, 0,
CMD_TARGET_CLIENT_USAGE,
CMD_PREPARECLIENT,
- cmd_display_panes_exec,
- NULL
+ cmd_display_panes_exec
};
enum cmd_retval
diff --git a/cmd-find-window.c b/cmd-find-window.c
index 7273633..e1ad542 100644
--- a/cmd-find-window.c
+++ b/cmd-find-window.c
@@ -52,8 +52,7 @@ const struct cmd_entry cmd_find_window_entry = {
"F:CNt:T", 1, 4,
"[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string",
CMD_PREPAREWINDOW,
- cmd_find_window_exec,
- NULL
+ cmd_find_window_exec
};
struct cmd_find_window_data {
diff --git a/cmd-has-session.c b/cmd-has-session.c
index 78a62f7..65485ea 100644
--- a/cmd-has-session.c
+++ b/cmd-has-session.c
@@ -31,8 +31,7 @@ const struct cmd_entry cmd_has_session_entry = {
"t:", 0, 0,
CMD_TARGET_SESSION_USAGE,
CMD_PREPAREWINDOW,
- cmd_has_session_exec,
- NULL
+ cmd_has_session_exec
};
enum cmd_retval
diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index 29783a8..3411128 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -30,7 +30,6 @@
*/
enum cmd_retval cmd_if_shell_exec(struct cmd *, struct cmd_q *);
-void cmd_if_shell_prepare(struct cmd *, struct cmd_q *);
void cmd_if_shell_callback(struct job *);
void cmd_if_shell_done(struct cmd_q *);
@@ -40,9 +39,8 @@ const struct cmd_entry cmd_if_shell_entry = {
"if-shell", "if",
"bFt:", 2, 3,
"[-bF] " CMD_TARGET_PANE_USAGE " shell-command command [command]",
- 0,
- cmd_if_shell_exec,
- NULL
+ CMD_PREPAREPANE,
+ cmd_if_shell_exec
};
struct cmd_if_shell_data {
@@ -53,18 +51,6 @@ struct cmd_if_shell_data {
int started;
};
-void
-cmd_if_shell_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (args_has(args, 't')) {
- cmdq->state.wl = cmd_find_pane(cmdq, args_get(args, 't'),
- &cmdq->state.s, &cmdq->state.wp);
- } else
- cmdq->state.c = cmd_find_client(cmdq, NULL, 1);
-}
-
enum cmd_retval
cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
{
@@ -81,7 +67,7 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
wl = cmdq->state.wl;
s = cmdq->state.s;
wp = cmdq->state.wp;
- c = cmdq->state.c;
+ c = cmd_find_client(cmdq, NULL, 1);
if (!args_has(args, 't') && c != NULL && c->session != NULL) {
s = c->session;
diff --git a/cmd-join-pane.c b/cmd-join-pane.c
index a6be1bf..e3bffa2 100644
--- a/cmd-join-pane.c
+++ b/cmd-join-pane.c
@@ -29,7 +29,6 @@
*/
enum cmd_retval cmd_join_pane_exec(struct cmd *, struct cmd_q *);
-void cmd_join_pane_prepare(struct cmd *, struct cmd_q *);
enum cmd_retval join_pane(struct cmd *, struct cmd_q *, int);
@@ -37,31 +36,18 @@ const struct cmd_entry cmd_join_pane_entry = {
"join-pane", "joinp",
"bdhvp:l:s:t:", 0, 0,
"[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
- CMD_PREPAREPANE,
- cmd_join_pane_exec,
- cmd_join_pane_prepare
+ CMD_PREPAREPANE|CMD_PREPAREPANE2,
+ cmd_join_pane_exec
};
const struct cmd_entry cmd_move_pane_entry = {
"move-pane", "movep",
"bdhvp:l:s:t:", 0, 0,
"[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
- CMD_PREPAREWINDOW,
- cmd_join_pane_exec,
- cmd_join_pane_prepare
+ CMD_PREPAREWINDOW|CMD_PREPAREPANE2,
+ cmd_join_pane_exec
};
-
-void
-cmd_join_pane_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- cmdq->state.wl = cmd_find_pane(cmdq, args_get(args, 't'),
- &cmdq->state.s, &cmdq->state.wp);
- cmdq->state.wl2 = cmd_find_pane(cmdq, args_get(args, 's'), NULL,
- &cmdq->state.wp2);
-}
enum cmd_retval
cmd_join_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{
diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c
index 26f0e0c..8962b59 100644
--- a/cmd-kill-pane.c
+++ b/cmd-kill-pane.c
@@ -27,15 +27,13 @@
*/
enum cmd_retval cmd_kill_pane_exec(struct cmd *, struct cmd_q *);
-void cmd_kill_pane_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_kill_pane_entry = {
"kill-pane", "killp",
"at:", 0, 0,
"[-a] " CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_kill_pane_exec,
- NULL
+ cmd_kill_pane_exec
};
enum cmd_retval
diff --git a/cmd-kill-server.c b/cmd-kill-server.c
index 930bef5..07d9430 100644
--- a/cmd-kill-server.c
+++ b/cmd-kill-server.c
@@ -34,8 +34,7 @@ const struct cmd_entry cmd_kill_server_entry = {
"", 0, 0,
"",
0,
- cmd_kill_server_exec,
- NULL
+ cmd_kill_server_exec
};
const struct cmd_entry cmd_start_server_entry = {
@@ -43,8 +42,7 @@ const struct cmd_entry cmd_start_server_entry = {
"", 0, 0,
"",
CMD_STARTSERVER,
- cmd_kill_server_exec,
- NULL
+ cmd_kill_server_exec
};
enum cmd_retval
diff --git a/cmd-kill-session.c b/cmd-kill-session.c
index 3515a67..4b6bcb6 100644
--- a/cmd-kill-session.c
+++ b/cmd-kill-session.c
@@ -28,15 +28,13 @@
*/
enum cmd_retval cmd_kill_session_exec(struct cmd *, struct cmd_q *);
-void cmd_kill_session_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_kill_session_entry = {
"kill-session", NULL,
"at:", 0, 0,
"[-a] " CMD_TARGET_SESSION_USAGE,
CMD_PREPARESESSION,
- cmd_kill_session_exec,
- NULL
+ cmd_kill_session_exec
};
enum cmd_retval
diff --git a/cmd-kill-window.c b/cmd-kill-window.c
index 3689440..4876638 100644
--- a/cmd-kill-window.c
+++ b/cmd-kill-window.c
@@ -31,17 +31,15 @@ const struct cmd_entry cmd_kill_window_entry = {
"at:", 0, 0,
"[-a] " CMD_TARGET_WINDOW_USAGE,
CMD_PREPAREWINDOW,
- cmd_kill_window_exec,
- NULL
+ cmd_kill_window_exec
};
const struct cmd_entry cmd_unlink_window_entry = {
"unlink-window", "unlinkw",
"kt:", 0, 0,
"[-k] " CMD_TARGET_WINDOW_USAGE,
- 0,
- cmd_kill_window_exec,
- NULL
+ CMD_PREPAREWINDOW,
+ cmd_kill_window_exec
};
enum cmd_retval
diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c
index 6c5db2c..8eb1610 100644
--- a/cmd-list-buffers.c
+++ b/cmd-list-buffers.c
@@ -37,8 +37,7 @@ const struct cmd_entry cmd_list_buffers_entry = {
"F:", 0, 0,
"[-F format]",
0,
- cmd_list_buffers_exec,
- NULL
+ cmd_list_buffers_exec
};
enum cmd_retval
diff --git a/cmd-list-clients.c b/cmd-list-clients.c
index 9b51e05..39ff759 100644
--- a/cmd-list-clients.c
+++ b/cmd-list-clients.c
@@ -40,8 +40,7 @@ const struct cmd_entry cmd_list_clients_entry = {
"F:t:", 0, 0,
"[-F format] " CMD_TARGET_SESSION_USAGE,
CMD_READONLY|CMD_PREPARESESSION,
- cmd_list_clients_exec,
- NULL
+ cmd_list_clients_exec
};
enum cmd_retval
diff --git a/cmd-list-keys.c b/cmd-list-keys.c
index de8310e..c8ef414 100644
--- a/cmd-list-keys.c
+++ b/cmd-list-keys.c
@@ -36,8 +36,7 @@ const struct cmd_entry cmd_list_keys_entry = {
"t:", 0, 0,
"[-t key-table]",
0,
- cmd_list_keys_exec,
- NULL
+ cmd_list_keys_exec
};
const struct cmd_entry cmd_list_commands_entry = {
diff --git a/cmd-list-panes.c b/cmd-list-panes.c
index caeb48e..8bb0488 100644
--- a/cmd-list-panes.c
+++ b/cmd-list-panes.c
@@ -28,7 +28,6 @@
*/
enum cmd_retval cmd_list_panes_exec(struct cmd *, struct cmd_q *);
-void cmd_list_panes_prepare(struct cmd *, struct cmd_q *);
void cmd_list_panes_server(struct cmd *, struct cmd_q *);
void cmd_list_panes_session(
@@ -40,24 +39,10 @@ const struct cmd_entry cmd_list_panes_entry = {
"list-panes", "lsp",
"asF:t:", 0, 0,
"[-as] [-F format] " CMD_TARGET_WINDOW_USAGE,
- CMD_PREPARESESSION|CMD_PREPAREWINDOW,
- cmd_list_panes_exec,
- cmd_list_panes_prepare
+ CMD_PREPARESESSION|CMD_PREPARESESSION2|CMD_PREPAREWINDOW,
+ cmd_list_panes_exec
};
-void
-cmd_list_panes_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (args_has(args, 's'))
- cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0);
- else if (args_has(args, 't')) {
- cmdq->state.wl = cmd_find_window(cmdq, args_get(args, 't'),
- &cmdq->state.s);
- }
-}
-
enum cmd_retval
cmd_list_panes_exec(struct cmd *self, struct cmd_q *cmdq)
{
diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c
index 5b4472f..ea8f3e3 100644
--- a/cmd-list-sessions.c
+++ b/cmd-list-sessions.c
@@ -43,8 +43,7 @@ const struct cmd_entry cmd_list_sessions_entry = {
"F:", 0, 0,
"[-F format]",
0,
- cmd_list_sessions_exec,
- NULL
+ cmd_list_sessions_exec
};
enum cmd_retval
diff --git a/cmd-list-windows.c b/cmd-list-windows.c
index 3cd980c..b4ebb45 100644
--- a/cmd-list-windows.c
+++ b/cmd-list-windows.c
@@ -40,7 +40,6 @@
"[#{window_width}x#{window_height}] "
enum cmd_retval cmd_list_windows_exec(struct cmd *, struct cmd_q *);
-void cmd_list_windows_prepare(struct cmd *, struct cmd_q *);
void cmd_list_windows_server(struct cmd *, struct cmd_q *);
void cmd_list_windows_session(struct cmd *, struct session *,
@@ -51,19 +50,9 @@ const struct cmd_entry cmd_list_windows_entry = {
"F:at:", 0, 0,
"[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
CMD_PREPARESESSION,
- cmd_list_windows_exec,
- cmd_list_windows_prepare
+ cmd_list_windows_exec
};
-void
-cmd_list_windows_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (!args_has(args, 'a'))
- cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0);
-}
-
enum cmd_retval
cmd_list_windows_exec(struct cmd *self, struct cmd_q *cmdq)
{
diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c
index fcf603d..785a701 100644
--- a/cmd-load-buffer.c
+++ b/cmd-load-buffer.c
@@ -39,8 +39,7 @@ const struct cmd_entry cmd_load_buffer_entry = {
"b:", 1, 1,
CMD_BUFFER_USAGE " path",
0,
- cmd_load_buffer_exec,
- NULL
+ cmd_load_buffer_exec
};
enum cmd_retval
diff --git a/cmd-lock-server.c b/cmd-lock-server.c
index 4c4ca6e..beaaad8 100644
--- a/cmd-lock-server.c
+++ b/cmd-lock-server.c
@@ -25,46 +25,31 @@
*/
enum cmd_retval cmd_lock_server_exec(struct cmd *, struct cmd_q *);
-void cmd_lock_server_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_lock_server_entry = {
"lock-server", "lock",
"", 0, 0,
"",
0,
- cmd_lock_server_exec,
- cmd_lock_server_prepare,
+ cmd_lock_server_exec
};
const struct cmd_entry cmd_lock_session_entry = {
"lock-session", "locks",
"t:", 0, 0,
CMD_TARGET_SESSION_USAGE,
- 0,
+ CMD_PREPARESESSION,
cmd_lock_server_exec,
- cmd_lock_server_prepare
};
const struct cmd_entry cmd_lock_client_entry = {
"lock-client", "lockc",
"t:", 0, 0,
CMD_TARGET_CLIENT_USAGE,
- 0,
- cmd_lock_server_exec,
- cmd_lock_server_prepare
+ CMD_PREPARECLIENT,
+ cmd_lock_server_exec
};
-void
-cmd_lock_server_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (self->entry == &cmd_lock_session_entry)
- cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0);
- else if (self->entry == &cmd_lock_client_entry)
- cmdq->state.c = cmd_find_client(cmdq, args_get(args, 't'), 0);
-}
-
enum cmd_retval
cmd_lock_server_exec(struct cmd *self, unused struct cmd_q *cmdq)
{
diff --git a/cmd-move-window.c b/cmd-move-window.c
index c32ad64..4b7b53e 100644
--- a/cmd-move-window.c
+++ b/cmd-move-window.c
@@ -27,15 +27,13 @@
*/
enum cmd_retval cmd_move_window_exec(struct cmd *, struct cmd_q *);
-void cmd_move_window_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_move_window_entry = {
"move-window", "movew",
"dkrs:t:", 0, 0,
"[-dkr] " CMD_SRCDST_WINDOW_USAGE,
- 0,
- cmd_move_window_exec,
- NULL
+ CMD_PREPARESESSION|CMD_PREPARESESSION2|CMD_PREPAREWINDOW,
+ cmd_move_window_exec
};
const struct cmd_entry cmd_link_window_entry = {
@@ -43,25 +41,9 @@ const struct cmd_entry cmd_link_window_entry = {
"dks:t:", 0, 0,
"[-dk] " CMD_SRCDST_WINDOW_USAGE,
CMD_PREPARESESSION|CMD_PREPAREWINDOW,
- cmd_move_window_exec,
- cmd_move_window_prepare
+ cmd_move_window_exec
};
-void
-cmd_move_window_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (args_has(args, 'r'))
- cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0);
- else {
- cmdq->state.wl = cmd_find_window(cmdq, args_get(args, 's'),
- &cmdq->state.s);
- cmdq->state.idx = cmd_find_index(cmdq, args_get(args, 't'),
- &cmdq->state.s2);
- }
-}
-
enum cmd_retval
cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq)
{
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 0a05cde..13fce54 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -41,18 +41,16 @@ const struct cmd_entry cmd_new_session_entry = {
"[-AdDP] [-c start-directory] [-F format] [-n window-name] "
"[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] "
"[-y height] [command]",
- CMD_STARTSERVER|CMD_CANTNEST,
- cmd_new_session_exec,
- NULL
+ CMD_STARTSERVER|CMD_CANTNEST|CMD_PREPARESESSION,
+ cmd_new_session_exec
};
const struct cmd_entry cmd_has_session_entry = {
"has-session", "has",
"t:", 0, 0,
CMD_TARGET_SESSION_USAGE,
- 0,
- cmd_new_session_exec,
- NULL
+ CMD_PREPARESESSION,
+ cmd_new_session_exec
};
enum cmd_retval
@@ -101,12 +99,11 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
}
target = args_get(args, 't');
+ groupwith = NULL;
if (target != NULL) {
- groupwith = cmd_find_session(cmdq, target, 0);
- if (groupwith == NULL)
+ if ((groupwith = cmdq->state.s) == NULL)
return (CMD_RETURN_ERROR);
- } else
- groupwith = NULL;
+ }
/* Set -d if no client. */
detached = args_has(args, 'd');
diff --git a/cmd-new-window.c b/cmd-new-window.c
index 4e222ba..5f66aa0 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -33,30 +33,16 @@
#define NEW_WINDOW_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}"
enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmd_q *);
-void cmd_new_window_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_new_window_entry = {
"new-window", "neww",
"ac:dF:kn:Pt:", 0, -1,
"[-adkP] [-c start-directory] [-F format] [-n window-name] "
CMD_TARGET_WINDOW_USAGE " [command]",
- CMD_PREPAREWINDOW,
- cmd_new_window_exec,
- cmd_new_window_prepare
+ CMD_PREPAREWINDOW|CMD_PREPAREIDX,
+ cmd_new_window_exec
};
-void
-cmd_new_window_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (args_has(args, 'a')) {
- cmdq->state.wl = cmd_find_window(cmdq, args_get(args, 't'),
- &cmdq->state.s);
- } else
- cmd_find_index(cmdq, args_get(args, 't'), &cmdq->state.s);
-}
-
enum cmd_retval
cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
{
@@ -66,7 +52,8 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
struct client *c;
const char *cmd, *path, *template;
char **argv, *cause, *cp;
- int argc, idx, last, detached, cwd, fd = -1;
+ int argc, last, detached, cwd, fd = -1;
+ int idx = cmdq->state.idx;
struct format_tree *ft;
struct environ_entry *envent;
@@ -92,7 +79,6 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
server_unlink_window(s, wl);
}
} else {
- idx = cmd_find_index(cmdq, args_get(args, 't'), &s);
if (idx == -2)
return (CMD_RETURN_ERROR);
}
diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c
index c99cb51..e76acd0 100644
--- a/cmd-paste-buffer.c
+++ b/cmd-paste-buffer.c
@@ -37,8 +37,7 @@ const struct cmd_entry cmd_paste_buffer_entry = {
"db:prs:t:", 0, 0,
"[-dpr] [-s separator] " CMD_BUFFER_USAGE " " CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_paste_buffer_exec,
- NULL
+ cmd_paste_buffer_exec
};
enum cmd_retval
diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c
index facab6f..952ceff 100644
--- a/cmd-pipe-pane.c
+++ b/cmd-pipe-pane.c
@@ -40,8 +40,7 @@ const struct cmd_entry cmd_pipe_pane_entry = {
"ot:", 0, 1,
"[-o] " CMD_TARGET_PANE_USAGE " [command]",
CMD_PREPAREPANE,
- cmd_pipe_pane_exec,
- NULL
+ cmd_pipe_pane_exec
};
enum cmd_retval
diff --git a/cmd-queue.c b/cmd-queue.c
index 12a3fe2..ced2823 100644
--- a/cmd-queue.c
+++ b/cmd-queue.c
@@ -44,7 +44,7 @@ cmdq_set_state(struct cmd_q *cmdq)
cmdq->state.wl = NULL;
cmdq->state.wp = NULL;
cmdq->state.tflag = NULL;
- cmdq->state.sflag = NULL;
+ cmdq->state.idx = -1;
cmd_prepare(cmdq->cmd, cmdq);
@@ -245,6 +245,7 @@ cmdq_continue(struct cmd_q *cmdq)
cmdq_run_hook(hooks, "before", cmdq->cmd, cmdq);
+ cmdq_set_state(cmdq);
retval = cmdq->cmd->entry->exec(cmdq->cmd, cmdq);
if (retval == CMD_RETURN_ERROR)
break;
diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c
index 969605b..258e781 100644
--- a/cmd-refresh-client.c
+++ b/cmd-refresh-client.c
@@ -31,8 +31,7 @@ const struct cmd_entry cmd_refresh_client_entry = {
"C:St:", 0, 0,
"[-S] [-C size] " CMD_TARGET_CLIENT_USAGE,
CMD_PREPARECLIENT,
- cmd_refresh_client_exec,
- NULL
+ cmd_refresh_client_exec
};
enum cmd_retval
diff --git a/cmd-rename-session.c b/cmd-rename-session.c
index e44c45b..9ce6919 100644
--- a/cmd-rename-session.c
+++ b/cmd-rename-session.c
@@ -27,15 +27,13 @@
*/
enum cmd_retval cmd_rename_session_exec(struct cmd *, struct cmd_q *);
-void cmd_rename_session_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_rename_session_entry = {
"rename-session", "rename",
"t:", 1, 1,
CMD_TARGET_SESSION_USAGE " new-name",
CMD_PREPARESESSION,
- cmd_rename_session_exec,
- NULL
+ cmd_rename_session_exec
};
enum cmd_retval
diff --git a/cmd-rename-window.c b/cmd-rename-window.c
index aeee5b9..821592c 100644
--- a/cmd-rename-window.c
+++ b/cmd-rename-window.c
@@ -27,15 +27,13 @@
*/
enum cmd_retval cmd_rename_window_exec(struct cmd *, struct cmd_q *);
-void cmd_rename_window_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_rename_window_entry = {
"rename-window", "renamew",
"t:", 1, 1,
CMD_TARGET_WINDOW_USAGE " new-name",
CMD_PREPAREWINDOW,
- cmd_rename_window_exec,
- NULL
+ cmd_rename_window_exec
};
enum cmd_retval
diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c
index b55b2c3..5301a57 100644
--- a/cmd-resize-pane.c
+++ b/cmd-resize-pane.c
@@ -33,8 +33,7 @@ const struct cmd_entry cmd_resize_pane_entry = {
"DLRt:Ux:y:Z", 0, 1,
"[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE "
[adjustment]",
CMD_PREPAREPANE,
- cmd_resize_pane_exec,
- NULL
+ cmd_resize_pane_exec
};
enum cmd_retval
diff --git a/cmd-respawn-pane.c b/cmd-respawn-pane.c
index 2aaee6b..e192772 100644
--- a/cmd-respawn-pane.c
+++ b/cmd-respawn-pane.c
@@ -35,8 +35,7 @@ const struct cmd_entry cmd_respawn_pane_entry = {
"kt:", 0, -1,
"[-k] " CMD_TARGET_PANE_USAGE " [command]",
CMD_PREPAREPANE,
- cmd_respawn_pane_exec,
- NULL
+ cmd_respawn_pane_exec
};
enum cmd_retval
diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c
index af21f2f..2fb68a0 100644
--- a/cmd-respawn-window.c
+++ b/cmd-respawn-window.c
@@ -34,8 +34,7 @@ const struct cmd_entry cmd_respawn_window_entry = {
"kt:", 0, -1,
"[-k] " CMD_TARGET_WINDOW_USAGE " [command]",
CMD_PREPAREWINDOW,
- cmd_respawn_window_exec,
- NULL
+ cmd_respawn_window_exec
};
enum cmd_retval
diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c
index 310268c..69b20d2 100644
--- a/cmd-rotate-window.c
+++ b/cmd-rotate-window.c
@@ -31,8 +31,7 @@ const struct cmd_entry cmd_rotate_window_entry = {
"Dt:U", 0, 0,
"[-DU] " CMD_TARGET_WINDOW_USAGE,
CMD_PREPAREWINDOW,
- cmd_rotate_window_exec,
- NULL
+ cmd_rotate_window_exec
};
enum cmd_retval
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index 2fb50c0..af4a701 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -40,8 +40,7 @@ const struct cmd_entry cmd_run_shell_entry = {
"bt:", 1, 1,
"[-b] " CMD_TARGET_PANE_USAGE " shell-command",
CMD_PREPAREPANE|CMD_PREPARESESSION,
- cmd_run_shell_exec,
- NULL
+ cmd_run_shell_exec
};
struct cmd_run_shell_data {
diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c
index e3ed06b..47a263d 100644
--- a/cmd-save-buffer.c
+++ b/cmd-save-buffer.c
@@ -38,8 +38,7 @@ const struct cmd_entry cmd_save_buffer_entry = {
"ab:", 1, 1,
"[-a] " CMD_BUFFER_USAGE " path",
0,
- cmd_save_buffer_exec,
- NULL
+ cmd_save_buffer_exec
};
const struct cmd_entry cmd_show_buffer_entry = {
@@ -47,8 +46,7 @@ const struct cmd_entry cmd_show_buffer_entry = {
"b:", 0, 0,
CMD_BUFFER_USAGE,
0,
- cmd_save_buffer_exec,
- NULL
+ cmd_save_buffer_exec
};
enum cmd_retval
diff --git a/cmd-select-layout.c b/cmd-select-layout.c
index 4eb3719..2859e0b 100644
--- a/cmd-select-layout.c
+++ b/cmd-select-layout.c
@@ -31,8 +31,7 @@ const struct cmd_entry cmd_select_layout_entry = {
"npt:", 0, 1,
"[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]",
CMD_PREPAREWINDOW,
- cmd_select_layout_exec,
- NULL
+ cmd_select_layout_exec
};
const struct cmd_entry cmd_next_layout_entry = {
@@ -40,8 +39,7 @@ const struct cmd_entry cmd_next_layout_entry = {
"t:", 0, 0,
CMD_TARGET_WINDOW_USAGE,
CMD_PREPAREWINDOW,
- cmd_select_layout_exec,
- NULL
+ cmd_select_layout_exec
};
const struct cmd_entry cmd_previous_layout_entry = {
@@ -49,8 +47,7 @@ const struct cmd_entry cmd_previous_layout_entry = {
"t:", 0, 0,
CMD_TARGET_WINDOW_USAGE,
CMD_PREPAREWINDOW,
- cmd_select_layout_exec,
- NULL
+ cmd_select_layout_exec
};
enum cmd_retval
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index e4bebc5..6e55330 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -25,15 +25,13 @@
*/
enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *);
-void cmd_select_pane_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_select_pane_entry = {
"select-pane", "selectp",
"DdeLlRt:U", 0, 0,
"[-DdeLlRU] " CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_select_pane_exec,
- cmd_select_pane_prepare
+ cmd_select_pane_exec
};
const struct cmd_entry cmd_last_pane_entry = {
@@ -41,23 +39,9 @@ const struct cmd_entry cmd_last_pane_entry = {
"det:", 0, 0,
"[-de] " CMD_TARGET_WINDOW_USAGE,
CMD_PREPAREPANE,
- cmd_select_pane_exec,
- cmd_select_pane_prepare
+ cmd_select_pane_exec
};
-void
-cmd_select_pane_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) {
- cmdq->state.wl = cmd_find_window(cmdq, args_get(args, 't'),
- NULL);
- } else {
- cmdq->state.wl = cmd_find_pane(cmdq, args_get(args, 't'), NULL,
- &cmdq->state.wp);
- }
-}
enum cmd_retval
cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq)
{
diff --git a/cmd-select-window.c b/cmd-select-window.c
index bbd7f71..d5e8846 100644
--- a/cmd-select-window.c
+++ b/cmd-select-window.c
@@ -27,15 +27,13 @@
*/
enum cmd_retval cmd_select_window_exec(struct cmd *, struct cmd_q *);
-void cmd_select_window_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_select_window_entry = {
"select-window", "selectw",
"lnpTt:", 0, 0,
"[-lnpT] " CMD_TARGET_WINDOW_USAGE,
CMD_PREPAREWINDOW,
- cmd_select_window_exec,
- cmd_select_window_prepare
+ cmd_select_window_exec
};
const struct cmd_entry cmd_next_window_entry = {
@@ -43,8 +41,7 @@ const struct cmd_entry cmd_next_window_entry = {
"at:", 0, 0,
"[-a] " CMD_TARGET_SESSION_USAGE,
CMD_PREPAREWINDOW,
- cmd_select_window_exec,
- cmd_select_window_prepare
+ cmd_select_window_exec
};
const struct cmd_entry cmd_previous_window_entry = {
@@ -52,8 +49,7 @@ const struct cmd_entry cmd_previous_window_entry = {
"at:", 0, 0,
"[-a] " CMD_TARGET_SESSION_USAGE,
CMD_PREPAREWINDOW,
- cmd_select_window_exec,
- cmd_select_window_prepare
+ cmd_select_window_exec
};
const struct cmd_entry cmd_last_window_entry = {
@@ -61,33 +57,9 @@ const struct cmd_entry cmd_last_window_entry = {
"t:", 0, 0,
CMD_TARGET_SESSION_USAGE,
CMD_PREPAREWINDOW,
- cmd_select_window_exec,
- cmd_select_window_prepare
+ cmd_select_window_exec
};
-void
-cmd_select_window_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
- int next, previous, last;
-
- next = self->entry == &cmd_next_window_entry;
- if (args_has(self->args, 'n'))
- next = 1;
- previous = self->entry == &cmd_previous_window_entry;
- if (args_has(self->args, 'p'))
- previous = 1;
- last = self->entry == &cmd_last_window_entry;
- if (args_has(self->args, 'l'))
- last = 1;
-
- if (next || previous || last)
- cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0);
- else {
- cmdq->state.wl = cmd_find_window(cmdq, args_get(args, 't'),
- &cmdq->state.s);
- }
-}
enum cmd_retval
cmd_select_window_exec(struct cmd *self, struct cmd_q *cmdq)
{
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index fb38d00..a3c9654 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -28,15 +28,13 @@
*/
enum cmd_retval cmd_send_keys_exec(struct cmd *, struct cmd_q *);
-void cmd_send_keys_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_send_keys_entry = {
"send-keys", "send",
"lRt:", 0, -1,
"[-lR] " CMD_TARGET_PANE_USAGE " key ...",
CMD_PREPAREPANE,
- cmd_send_keys_exec,
- NULL
+ cmd_send_keys_exec
};
const struct cmd_entry cmd_send_prefix_entry = {
@@ -44,8 +42,7 @@ const struct cmd_entry cmd_send_prefix_entry = {
"2t:", 0, 0,
"[-2] " CMD_TARGET_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_send_keys_exec,
- NULL
+ cmd_send_keys_exec
};
enum cmd_retval
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index afa7069..0ec362b 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -34,8 +34,7 @@ const struct cmd_entry cmd_set_buffer_entry = {
"ab:n:", 0, 1,
"[-a] " CMD_BUFFER_USAGE " [-n new-buffer-name] data",
0,
- cmd_set_buffer_exec,
- NULL
+ cmd_set_buffer_exec
};
enum cmd_retval
diff --git a/cmd-set-environment.c b/cmd-set-environment.c
index bf65a3f..1be1666 100644
--- a/cmd-set-environment.c
+++ b/cmd-set-environment.c
@@ -28,15 +28,13 @@
*/
enum cmd_retval cmd_set_environment_exec(struct cmd *, struct cmd_q *);
-void cmd_set_environment_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_set_environment_entry = {
"set-environment", "setenv",
"grt:u", 1, 2,
"[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
CMD_PREPARESESSION,
- cmd_set_environment_exec,
- NULL
+ cmd_set_environment_exec
};
enum cmd_retval
diff --git a/cmd-set-hook.c b/cmd-set-hook.c
index 75aebb9..4864c66 100644
--- a/cmd-set-hook.c
+++ b/cmd-set-hook.c
@@ -28,15 +28,13 @@
*/
enum cmd_retval cmd_set_hook_exec(struct cmd *, struct cmd_q *);
-void cmd_set_hook_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_set_hook_entry = {
"set-hook", NULL,
"gt:u", 1, 2,
"[-gu]" CMD_TARGET_SESSION_USAGE " hook-name [command]",
CMD_PREPARESESSION,
- cmd_set_hook_exec,
- NULL
+ cmd_set_hook_exec
};
enum cmd_retval
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 6bc0e56..01d691d 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -69,8 +69,7 @@ const struct cmd_entry cmd_set_option_entry = {
"agoqst:uw", 1, 2,
"[-agosquw] [-t target-session|target-window] option [value]",
0,
- cmd_set_option_exec,
- NULL
+ cmd_set_option_exec
};
const struct cmd_entry cmd_set_window_option_entry = {
@@ -78,8 +77,7 @@ const struct cmd_entry cmd_set_window_option_entry = {
"agoqt:u", 1, 2,
"[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
0,
- cmd_set_option_exec,
- NULL
+ cmd_set_option_exec
};
enum cmd_retval
diff --git a/cmd-show-environment.c b/cmd-show-environment.c
index e5bacd6..dafd724 100644
--- a/cmd-show-environment.c
+++ b/cmd-show-environment.c
@@ -35,8 +35,7 @@ const struct cmd_entry cmd_show_environment_entry = {
"gt:", 0, 1,
"[-g] " CMD_TARGET_SESSION_USAGE " [name]",
CMD_PREPARESESSION,
- cmd_show_environment_exec,
- NULL
+ cmd_show_environment_exec
};
enum cmd_retval
diff --git a/cmd-show-hooks.c b/cmd-show-hooks.c
index 4babd76..aee0c27 100644
--- a/cmd-show-hooks.c
+++ b/cmd-show-hooks.c
@@ -34,8 +34,7 @@ const struct cmd_entry cmd_show_hooks_entry = {
"gt:", 0, 1,
"[-g] " CMD_TARGET_SESSION_USAGE,
CMD_PREPARESESSION,
- cmd_show_hooks_exec,
- NULL
+ cmd_show_hooks_exec
};
enum cmd_retval
diff --git a/cmd-show-messages.c b/cmd-show-messages.c
index aa74be4..90f32f3 100644
--- a/cmd-show-messages.c
+++ b/cmd-show-messages.c
@@ -35,8 +35,7 @@ const struct cmd_entry cmd_show_messages_entry = {
"IJTt:", 0, 0,
"[-IJT] " CMD_TARGET_CLIENT_USAGE,
CMD_PREPARECLIENT,
- cmd_show_messages_exec,
- NULL
+ cmd_show_messages_exec
};
const struct cmd_entry cmd_server_info_entry = {
@@ -44,8 +43,7 @@ const struct cmd_entry cmd_server_info_entry = {
"", 0, 0,
"",
0,
- cmd_show_messages_exec,
- NULL
+ cmd_show_messages_exec
};
void cmd_show_messages_server(struct cmd_q *);
diff --git a/cmd-show-options.c b/cmd-show-options.c
index dc596ca..c87ab51 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -28,7 +28,6 @@
*/
enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmd_q *);
-void cmd_show_options_prepare(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_show_options_one(struct cmd *, struct cmd_q *,
struct options *, int);
@@ -40,32 +39,17 @@ const struct cmd_entry cmd_show_options_entry = {
"gqst:vw", 0, 1,
"[-gqsvw] [-t target-session|target-window] [option]",
CMD_PREPARESESSION|CMD_PREPAREWINDOW,
- cmd_show_options_exec,
- cmd_show_options_prepare
+ cmd_show_options_exec
};
const struct cmd_entry cmd_show_window_options_entry = {
"show-window-options", "showw",
"gvt:", 0, 1,
"[-gv] " CMD_TARGET_WINDOW_USAGE " [option]",
- 0,
- cmd_show_options_exec,
- cmd_show_options_prepare
+ CMD_PREPARESESSION|CMD_PREPAREWINDOW,
+ cmd_show_options_exec
};
-void
-cmd_show_options_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- if (args_has(args, 'g') && args_has(args, 'w') &&
- self->entry == &cmd_show_window_options_entry) {
- cmdq->state.wl = cmd_find_window(cmdq, args_get(args, 't'),
- NULL);
- } else
- cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0);
-}
-
enum cmd_retval
cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
{
diff --git a/cmd-source-file.c b/cmd-source-file.c
index 247e72f..e5710a0 100644
--- a/cmd-source-file.c
+++ b/cmd-source-file.c
@@ -35,8 +35,7 @@ const struct cmd_entry cmd_source_file_entry = {
"", 1, 1,
"path",
0,
- cmd_source_file_exec,
- NULL
+ cmd_source_file_exec
};
enum cmd_retval
diff --git a/cmd-split-window.c b/cmd-split-window.c
index 88c2635..f2465e0 100644
--- a/cmd-split-window.c
+++ b/cmd-split-window.c
@@ -40,8 +40,7 @@ const struct cmd_entry cmd_split_window_entry = {
"[-bdhvP] [-c start-directory] [-F format] [-p percentage|-l size] "
CMD_TARGET_PANE_USAGE " [command]",
CMD_PREPAREPANE,
- cmd_split_window_exec,
- NULL
+ cmd_split_window_exec
};
enum cmd_retval
diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c
index 75094cb..75c610b 100644
--- a/cmd-swap-pane.c
+++ b/cmd-swap-pane.c
@@ -33,8 +33,7 @@ const struct cmd_entry cmd_swap_pane_entry = {
"dDs:t:U", 0, 0,
"[-dDU] " CMD_SRCDST_PANE_USAGE,
CMD_PREPAREPANE,
- cmd_swap_pane_exec,
- NULL
+ cmd_swap_pane_exec
};
enum cmd_retval
diff --git a/cmd-swap-window.c b/cmd-swap-window.c
index 745b2bf..52f1dde 100644
--- a/cmd-swap-window.c
+++ b/cmd-swap-window.c
@@ -27,28 +27,14 @@
*/
enum cmd_retval cmd_swap_window_exec(struct cmd *, struct cmd_q *);
-void cmd_swap_window_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_swap_window_entry = {
"swap-window", "swapw",
"ds:t:", 0, 0,
"[-d] " CMD_SRCDST_WINDOW_USAGE,
- CMD_PREPAREWINDOW,
- cmd_swap_window_exec,
- cmd_swap_window_prepare
+ CMD_PREPAREWINDOW|CMD_PREPARESESSION2
};
-void
-cmd_swap_window_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- cmdq->state.wl = cmd_find_window(cmdq, args_get(args, 's'),
- &cmdq->state.s);
- cmdq->state.wl2 = cmd_find_window(cmdq, args_get(args, 't'),
- &cmdq->state.s2);
-}
-
enum cmd_retval
cmd_swap_window_exec(struct cmd *self, struct cmd_q *cmdq)
{
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index b95f250..de3721c 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -28,26 +28,15 @@
*/
enum cmd_retval cmd_switch_client_exec(struct cmd *, struct cmd_q *);
-void cmd_switch_client_prepare(struct cmd *, struct cmd_q *);
const struct cmd_entry cmd_switch_client_entry = {
"switch-client", "switchc",
"lc:npt:r", 0, 0,
"[-lnpr] [-c target-client] [-t target-session]",
- CMD_READONLY|CMD_PREPARECLIENT|CMD_PREPARESESSION,
- cmd_switch_client_exec,
- cmd_switch_client_prepare
+ CMD_READONLY|CMD_PREPARESESSION,
+ cmd_switch_client_exec
};
-void
-cmd_switch_client_prepare(struct cmd *self, struct cmd_q *cmdq)
-{
- struct args *args = self->args;
-
- cmdq->state.c = cmd_find_client(cmdq, args_get(args, 'c'), 0);
- cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0);
-}
-
enum cmd_retval
cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
{
@@ -59,7 +48,7 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq)
struct window_pane *wp = NULL;
const char *tflag;
- if ((c = cmdq->state.c) == NULL)
+ if ((c = cmd_find_client(cmdq, args_get(args, 'c'), 0)) == NULL)
return (CMD_RETURN_ERROR);
if (args_has(args, 'r')) {
diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c
index 284c86e..710210c 100644
--- a/cmd-unbind-key.c
+++ b/cmd-unbind-key.c
@@ -34,8 +34,7 @@ const struct cmd_entry cmd_unbind_key_entry = {
"acnt:", 0, 1,
"[-acn] [-t mode-table] key",
0,
- cmd_unbind_key_exec,
- NULL
+ cmd_unbind_key_exec
};
enum cmd_retval
diff --git a/cmd-wait-for.c b/cmd-wait-for.c
index c90427d..a3e8585 100644
--- a/cmd-wait-for.c
+++ b/cmd-wait-for.c
@@ -35,8 +35,7 @@ const struct cmd_entry cmd_wait_for_entry = {
"LSU", 1, 1,
"[-L|-S|-U] channel",
0,
- cmd_wait_for_exec,
- NULL
+ cmd_wait_for_exec
};
struct wait_channel {
diff --git a/cmd.c b/cmd.c
index 205b241..bbee673 100644
--- a/cmd.c
+++ b/cmd.c
@@ -319,6 +319,7 @@ cmd_prepare(struct cmd *cmd, struct cmd_q *cmdq)
{
struct args *args = cmd->args;
const char *tflag = args_get(args, 't');
+ const char *sflag = args_get(args, 's');
struct cmd_state *state = &cmdq->state;
/* FIXME: Handle this! What should happen during cfg_load? */
@@ -335,15 +336,18 @@ cmd_prepare(struct cmd *cmd, struct cmd_q *cmdq)
if (cmd->entry->flags & CMD_PREPARESESSION)
state->s = cmd_find_session(cmdq, tflag, 0);
+ if (cmd->entry->flags & CMD_PREPARESESSION2)
+ state->s2 = cmd_find_session(cmdq, sflag, 0);
if (cmd->entry->flags & CMD_PREPAREWINDOW)
state->wl = cmd_find_window(cmdq, tflag, NULL);
if (cmd->entry->flags & CMD_PREPAREPANE)
state->wl = cmd_find_pane(cmdq, tflag, &state->s, &state->wp);
+ if (cmd->entry->flags & CMD_PREPAREPANE2)
+ state->wl2 = cmd_find_pane(cmdq, sflag, &state->s, &state->wp);
if (cmd->entry->flags & CMD_PREPARECLIENT)
state->c = cmd_find_client(cmdq, tflag, 0);
-
- if (cmd->entry->prepare != NULL)
- cmd->entry->prepare(cmd, cmdq);
+ if (cmd->entry->flags & CMD_PREPAREIDX)
+ state->idx = cmd_find_index(cmdq, tflag, &state->s);
}
size_t
diff --git a/tmux.h b/tmux.h
index ba79969..3b34753 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1371,7 +1371,6 @@ struct cmd_state {
struct winlink *wl2;
struct window *w;
- struct window *w2;
struct window_pane *wp;
struct window_pane *wp2;
@@ -1379,10 +1378,7 @@ struct cmd_state {
int idx;
const char *tflag;
- const char *sflag;
-
const char *prior_tflag;
- const char *prior_sflag;
};
/* Command and list of commands. */
@@ -1455,13 +1451,15 @@ struct cmd_entry {
#define CMD_CANTNEST 0x2
#define CMD_READONLY 0x4
#define CMD_PREPARESESSION 0x8
-#define CMD_PREPAREWINDOW 0x10
-#define CMD_PREPAREPANE 0x20
-#define CMD_PREPARECLIENT 0x40
+#define CMD_PREPARESESSION2 0x10
+#define CMD_PREPAREWINDOW 0x20
+#define CMD_PREPAREPANE 0x40
+#define CMD_PREPAREPANE2 0x80
+#define CMD_PREPARECLIENT 0x100
+#define CMD_PREPAREIDX 0x200
int flags;
enum cmd_retval (*exec)(struct cmd *, struct cmd_q *);
- void (*prepare)(struct cmd *, struct cmd_q *);
};
/* Key binding. */
-----------------------------------------------------------------------
Summary of changes:
cmd-attach-session.c | 5 +----
cmd-bind-key.c | 3 +--
cmd-break-pane.c | 3 +--
cmd-capture-pane.c | 3 +--
cmd-choose-buffer.c | 3 +--
cmd-choose-client.c | 4 +---
cmd-choose-tree.c | 9 +++------
cmd-clear-history.c | 4 +---
cmd-clock-mode.c | 3 +--
cmd-command-prompt.c | 3 +--
cmd-confirm-before.c | 3 +--
cmd-copy-mode.c | 3 +--
cmd-delete-buffer.c | 3 +--
cmd-detach-client.c | 20 +++-----------------
cmd-display-message.c | 27 +++------------------------
cmd-display-panes.c | 3 +--
cmd-find-window.c | 3 +--
cmd-has-session.c | 3 +--
cmd-if-shell.c | 20 +++-----------------
cmd-join-pane.c | 22 ++++------------------
cmd-kill-pane.c | 4 +---
cmd-kill-server.c | 6 ++----
cmd-kill-session.c | 4 +---
cmd-kill-window.c | 8 +++-----
cmd-list-buffers.c | 3 +--
cmd-list-clients.c | 3 +--
cmd-list-keys.c | 3 +--
cmd-list-panes.c | 19 ++-----------------
cmd-list-sessions.c | 3 +--
cmd-list-windows.c | 13 +------------
cmd-load-buffer.c | 3 +--
cmd-lock-server.c | 23 ++++-------------------
cmd-move-window.c | 24 +++---------------------
cmd-new-session.c | 17 +++++++----------
cmd-new-window.c | 22 ++++------------------
cmd-paste-buffer.c | 3 +--
cmd-pipe-pane.c | 3 +--
cmd-queue.c | 3 ++-
cmd-refresh-client.c | 3 +--
cmd-rename-session.c | 4 +---
cmd-rename-window.c | 4 +---
cmd-resize-pane.c | 3 +--
cmd-respawn-pane.c | 3 +--
cmd-respawn-window.c | 3 +--
cmd-rotate-window.c | 3 +--
cmd-run-shell.c | 3 +--
cmd-save-buffer.c | 6 ++----
cmd-select-layout.c | 9 +++------
cmd-select-pane.c | 20 ++------------------
cmd-select-window.c | 36 ++++--------------------------------
cmd-send-keys.c | 7 ++-----
cmd-set-buffer.c | 3 +--
cmd-set-environment.c | 4 +---
cmd-set-hook.c | 4 +---
cmd-set-option.c | 6 ++----
cmd-show-environment.c | 3 +--
cmd-show-hooks.c | 3 +--
cmd-show-messages.c | 6 ++----
cmd-show-options.c | 22 +++-------------------
cmd-source-file.c | 3 +--
cmd-split-window.c | 3 +--
cmd-swap-pane.c | 3 +--
cmd-swap-window.c | 16 +---------------
cmd-switch-client.c | 17 +++--------------
cmd-unbind-key.c | 3 +--
cmd-wait-for.c | 3 +--
cmd.c | 10 +++++++---
tmux.h | 14 ++++++--------
68 files changed, 123 insertions(+), 415 deletions(-)
hooks/post-receive
--
tmux
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs