The branch, hooks has been updated via ed46c24babb9663aace1ee8aee8c52f247cee87b (commit) from 87101f81b1b4708fee9594054095a8279f01b5fc (commit)
- Log ----------------------------------------------------------------- commit ed46c24babb9663aace1ee8aee8c52f247cee87b Author: Thomas Adam <tho...@xteddy.org> Commit: Thomas Adam <tho...@xteddy.org> Provide current_state and default_state for cmds So that we don't trample on different contexts when interpolating out which sessions, winlinks, panes to use, etc. These will be used when deriving the hook's context for the given command. Currently renamed cmdq->state to cmdq->current_state; implementation for default_state comes later. --- cmd-break-pane.c | 6 +++--- cmd-capture-pane.c | 2 +- cmd-choose-buffer.c | 4 ++-- cmd-choose-client.c | 4 ++-- cmd-choose-list.c | 4 ++-- cmd-choose-tree.c | 6 +++--- cmd-clear-history.c | 2 +- cmd-clock-mode.c | 2 +- cmd-command-prompt.c | 2 +- cmd-confirm-before.c | 2 +- cmd-copy-mode.c | 2 +- cmd-detach-client.c | 8 ++++---- cmd-display-message.c | 20 ++++++++++---------- cmd-display-panes.c | 2 +- cmd-find-window.c | 4 ++-- cmd-has-session.c | 2 +- cmd-if-shell.c | 14 +++++++------- cmd-join-pane.c | 18 +++++++++--------- cmd-kill-pane.c | 4 ++-- cmd-kill-session.c | 2 +- cmd-kill-window.c | 4 ++-- cmd-link-window.c | 16 ++++++++-------- cmd-list-clients.c | 2 +- cmd-list-panes.c | 10 +++++----- cmd-list-windows.c | 4 ++-- cmd-lock-server.c | 8 ++++---- cmd-move-window.c | 20 ++++++++++---------- cmd-new-window.c | 10 +++++----- cmd-paste-buffer.c | 4 ++-- cmd-pipe-pane.c | 4 ++-- cmd-queue.c | 18 +++++++++--------- cmd-refresh-client.c | 2 +- cmd-rename-session.c | 2 +- cmd-rename-window.c | 2 +- cmd-resize-pane.c | 4 ++-- cmd-respawn-pane.c | 6 +++--- cmd-respawn-window.c | 4 ++-- cmd-rotate-window.c | 2 +- cmd-run-shell.c | 8 ++++---- cmd-select-layout.c | 2 +- cmd-select-pane.c | 12 ++++++------ cmd-select-window.c | 12 ++++++------ cmd-send-keys.c | 6 +++--- cmd-set-environment.c | 2 +- cmd-set-hook.c | 2 +- cmd-show-environment.c | 2 +- cmd-show-hooks.c | 2 +- cmd-show-messages.c | 2 +- cmd-show-options.c | 8 ++++---- cmd-split-window.c | 6 +++--- cmd-suspend-client.c | 2 +- cmd-swap-pane.c | 4 ++-- cmd-swap-window.c | 16 ++++++++-------- cmd-switch-client.c | 6 +++--- cmd-unlink-window.c | 4 ++-- cmd.c | 4 ++-- tmux.h | 3 ++- 57 files changed, 168 insertions(+), 167 deletions(-) diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 2065add..999ee6f 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -55,10 +55,10 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_q *cmdq) const char *template; char *cp; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - wp = cmdq->state.wp; - s = cmdq->state.s; + wp = cmdq->current_state.wp; + s = cmdq->current_state.s; if (window_count_panes(wl->window) == 1) { cmdq_error(cmdq, "can't break with only one pane"); diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index a7d016f..0c79c72 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -171,7 +171,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq) u_int limit; size_t len; - if ((wp = cmdq->state.wp) == NULL) + if ((wp = cmdq->current_state.wp) == NULL) return (CMD_RETURN_ERROR); len = 0; diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c index 688133e..e037112 100644 --- a/cmd-choose-buffer.c +++ b/cmd-choose-buffer.c @@ -52,7 +52,7 @@ cmd_choose_buffer_exec(struct cmd *self, struct cmd_q *cmdq) const char *template; u_int idx; - if ((c = cmdq->state.c) == NULL) { + if ((c = cmdq->current_state.c) == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } @@ -60,7 +60,7 @@ cmd_choose_buffer_exec(struct cmd *self, struct cmd_q *cmdq) if ((template = args_get(args, 'F')) == NULL) template = CHOOSE_BUFFER_TEMPLATE; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); if (paste_get_top(&global_buffers) == NULL) diff --git a/cmd-choose-client.c b/cmd-choose-client.c index 16e5bcc..5be0d9e 100644 --- a/cmd-choose-client.c +++ b/cmd-choose-client.c @@ -58,12 +58,12 @@ cmd_choose_client_exec(struct cmd *self, struct cmd_q *cmdq) char *action; u_int i, idx, cur; - if ((c = cmdq->state.c) == NULL) { + if ((c = cmdq->current_state.c) == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) diff --git a/cmd-choose-list.c b/cmd-choose-list.c index b092146..0adcdb7 100644 --- a/cmd-choose-list.c +++ b/cmd-choose-list.c @@ -54,7 +54,7 @@ cmd_choose_list_exec(struct cmd *self, struct cmd_q *cmdq) char *template, *item, *copy, *list; u_int idx; - if ((c = cmdq->state.c) == NULL) { + if ((c = cmdq->current_state.c) == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } @@ -62,7 +62,7 @@ cmd_choose_list_exec(struct cmd *self, struct cmd_q *cmdq) if ((list1 = args_get(args, 'l')) == NULL) return (CMD_RETURN_ERROR); - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c index 4448d3e..8b06529 100644 --- a/cmd-choose-tree.c +++ b/cmd-choose-tree.c @@ -85,15 +85,15 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_q *cmdq) ses_template = win_template = NULL; ses_action = win_action = NULL; - if ((c = cmdq->state.c) == NULL) { + if ((c = cmdq->current_state.c) == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } - if ((s = cmdq->state.c->session) == NULL) + if ((s = cmdq->current_state.c->session) == NULL) return (CMD_RETURN_ERROR); - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) diff --git a/cmd-clear-history.c b/cmd-clear-history.c index e4539ca..6d49b29 100644 --- a/cmd-clear-history.c +++ b/cmd-clear-history.c @@ -43,7 +43,7 @@ cmd_clear_history_exec(unused struct cmd *self, struct cmd_q *cmdq) struct window_pane *wp; struct grid *gd; - if ((wp = cmdq->state.wp) == NULL) + if ((wp = cmdq->current_state.wp) == NULL) return (CMD_RETURN_ERROR); gd = wp->base.grid; diff --git a/cmd-clock-mode.c b/cmd-clock-mode.c index ab102b6..48b86aa 100644 --- a/cmd-clock-mode.c +++ b/cmd-clock-mode.c @@ -42,7 +42,7 @@ cmd_clock_mode_exec(unused struct cmd *self, struct cmd_q *cmdq) { struct window_pane *wp; - if ((wp = cmdq->state.wp) == NULL) + if ((wp = cmdq->current_state.wp) == NULL) return (CMD_RETURN_ERROR); window_pane_set_mode(wp, &window_clock_mode); diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index c2959ed..39d9047 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -94,7 +94,7 @@ cmd_command_prompt_exec(struct cmd *self, struct cmd_q *cmdq) char *prompt, *ptr, *input = NULL; size_t n; - if ((c = cmdq->state.c) == NULL) + if ((c = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); if (c->prompt_string != NULL) diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index 248dc03..2c444d7 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -75,7 +75,7 @@ cmd_confirm_before_exec(struct cmd *self, struct cmd_q *cmdq) char *cmd, *copy, *new_prompt, *ptr; const char *prompt; - if ((c = cmdq->state.c) == NULL) + if ((c = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); if ((prompt = args_get(args, 'p')) != NULL) diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index acede4f..626258d 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -51,7 +51,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq) { struct window_pane *wp; - if ((wp = cmdq->state.wp) == NULL) + if ((wp = cmdq->current_state.wp) == NULL) return (CMD_RETURN_ERROR); if (wp->mode != &window_copy_mode) { diff --git a/cmd-detach-client.c b/cmd-detach-client.c index 826a05a..8e0f0cd 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -45,9 +45,9 @@ 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); + cmdq->current_state.s = cmd_find_session(cmdq, args_get(args, 's'), 0); else - cmdq->state.c = cmd_find_client(cmdq, args_get(args, 't'), 0); + cmdq->current_state.c = cmd_find_client(cmdq, args_get(args, 't'), 0); } enum cmd_retval @@ -65,7 +65,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 = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); for (i = 0; i < ARRAY_LENGTH(&clients); i++) { @@ -76,7 +76,7 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) strlen(c->session->name) + 1); } } else { - if ((c = cmdq->state.c) == NULL) + if ((c = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); if (args_has(args, 'a')) { diff --git a/cmd-display-message.c b/cmd-display-message.c index 7775ca0..d1b5548 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -47,17 +47,17 @@ 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); + cmdq->current_state.wl = cmd_find_pane(cmdq, args_get(args, 't'), + &cmdq->current_state.s, &cmdq->current_state.wp); } else { - cmdq->state.wl = cmd_find_pane(cmdq, NULL, &cmdq->state.s, - &cmdq->state.wp); + cmdq->current_state.wl = cmd_find_pane(cmdq, NULL, &cmdq->current_state.s, + &cmdq->current_state.wp); } if (args_has(args, 'c')) - cmdq->state.c = cmd_find_client(cmdq, args_get(args, 'c'), 0); + cmdq->current_state.c = cmd_find_client(cmdq, args_get(args, 'c'), 0); else - cmdq->state.c = cmd_current_client(cmdq); + cmdq->current_state.c = cmd_current_client(cmdq); } enum cmd_retval @@ -75,18 +75,18 @@ cmd_display_message_exec(struct cmd *self, struct cmd_q *cmdq) time_t t; size_t len; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - wp = cmdq->state.wp; - s = cmdq->state.s; + wp = cmdq->current_state.wp; + s = cmdq->current_state.s; if (args_has(args, 'F') && args->argc != 0) { cmdq_error(cmdq, "only one of -F or argument must be given"); return (CMD_RETURN_ERROR); } - c = cmdq->state.c; + c = cmdq->current_state.c; if (args_has(args, 'c')) { if (c == NULL) return (CMD_RETURN_ERROR); diff --git a/cmd-display-panes.c b/cmd-display-panes.c index 29c7bea..32caad0 100644 --- a/cmd-display-panes.c +++ b/cmd-display-panes.c @@ -42,7 +42,7 @@ cmd_display_panes_exec(unused struct cmd *self, struct cmd_q *cmdq) { struct client *c; - if ((c = cmdq->state.c) == NULL) + if ((c = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); server_set_identify(c); diff --git a/cmd-find-window.c b/cmd-find-window.c index bf3d5e3..cb414f0 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -140,13 +140,13 @@ cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq) const char *template; u_int i, match_flags; - if ((c = cmdq->state.c) == NULL) { + if ((c = cmdq->current_state.c) == NULL) { cmdq_error(cmdq, "no client available"); return (CMD_RETURN_ERROR); } s = c->session; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); if ((template = args_get(args, 'F')) == NULL) diff --git a/cmd-has-session.c b/cmd-has-session.c index ca00f0d..402725b 100644 --- a/cmd-has-session.c +++ b/cmd-has-session.c @@ -40,7 +40,7 @@ const struct cmd_entry cmd_has_session_entry = { enum cmd_retval cmd_has_session_exec(unused struct cmd *self, struct cmd_q *cmdq) { - if (cmdq->state.s == NULL) + if (cmdq->current_state.s == NULL) return (CMD_RETURN_ERROR); return (CMD_RETURN_NORMAL); diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 15382f6..5943399 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -60,10 +60,10 @@ 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); + cmdq->current_state.wl = cmd_find_pane(cmdq, args_get(args, 't'), + &cmdq->current_state.s, &cmdq->current_state.wp); } else - cmdq->state.c = cmd_find_client(cmdq, NULL, 1); + cmdq->current_state.c = cmd_find_client(cmdq, NULL, 1); } enum cmd_retval @@ -78,10 +78,10 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq) struct window_pane *wp = NULL; struct format_tree *ft; - wl = cmdq->state.wl; - s = cmdq->state.s; - wp = cmdq->state.wp; - c = cmdq->state.c; + wl = cmdq->current_state.wl; + s = cmdq->current_state.s; + wp = cmdq->current_state.wp; + c = cmdq->current_state.c; 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 b773e97..6f19d13 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -59,10 +59,10 @@ 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); + cmdq->current_state.wl = cmd_find_pane(cmdq, args_get(args, 't'), + &cmdq->current_state.s, &cmdq->current_state.wp); + cmdq->current_state.wl2 = cmd_find_pane(cmdq, args_get(args, 's'), NULL, + &cmdq->current_state.wp2); } void @@ -98,17 +98,17 @@ join_pane(struct cmd *self, struct cmd_q *cmdq, int not_same_window) enum layout_type type; struct layout_cell *lc; - if ((dst_wl = cmdq->state.wl) == NULL) + if ((dst_wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - dst_s = cmdq->state.s; - dst_wp = cmdq->state.wp; + dst_s = cmdq->current_state.s; + dst_wp = cmdq->current_state.wp; dst_w = dst_wl->window; dst_idx = dst_wl->idx; server_unzoom_window(dst_w); - if ((src_wl = cmdq->state.wl2) == NULL) + if ((src_wl = cmdq->current_state.wl2) == NULL) return (CMD_RETURN_ERROR); - src_wp = cmdq->state.wp2; + src_wp = cmdq->current_state.wp2; src_w = src_wl->window; server_unzoom_window(src_w); diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c index ec9726f..d933eb5 100644 --- a/cmd-kill-pane.c +++ b/cmd-kill-pane.c @@ -45,9 +45,9 @@ cmd_kill_pane_exec(struct cmd *self, struct cmd_q *cmdq) struct winlink *wl; struct window_pane *loopwp, *tmpwp, *wp; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - wp = cmdq->state.wp; + wp = cmdq->current_state.wp; server_unzoom_window(wl->window); if (window_count_panes(wl->window) == 1) { diff --git a/cmd-kill-session.c b/cmd-kill-session.c index 7a33c0c..506e428 100644 --- a/cmd-kill-session.c +++ b/cmd-kill-session.c @@ -46,7 +46,7 @@ cmd_kill_session_exec(struct cmd *self, struct cmd_q *cmdq) struct args *args = self->args; struct session *s, *s2, *s3; - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); if (args_has(args, 'a')) { diff --git a/cmd-kill-window.c b/cmd-kill-window.c index b431f01..48f838e 100644 --- a/cmd-kill-window.c +++ b/cmd-kill-window.c @@ -44,10 +44,10 @@ cmd_kill_window_exec(struct cmd *self, struct cmd_q *cmdq) struct winlink *wl, *wl2, *wl3; struct session *s; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - s = cmdq->state.s; + s = cmdq->current_state.s; if (args_has(args, 'a')) { RB_FOREACH_SAFE(wl2, winlinks, &s->windows, wl3) { diff --git a/cmd-link-window.c b/cmd-link-window.c index 72e1b00..f347a9c 100644 --- a/cmd-link-window.c +++ b/cmd-link-window.c @@ -44,10 +44,10 @@ cmd_link_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.idx = cmd_find_index(cmdq, args_get(args, 't'), - &cmdq->state.s2); + cmdq->current_state.wl = cmd_find_window(cmdq, args_get(args, 's'), + &cmdq->current_state.s); + cmdq->current_state.idx = cmd_find_index(cmdq, args_get(args, 't'), + &cmdq->current_state.s2); } enum cmd_retval @@ -58,13 +58,13 @@ cmd_link_window_exec(struct cmd *self, struct cmd_q *cmdq) char *cause; int idx, kflag, dflag; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - if ((idx = cmdq->state.idx) == -2) + if ((idx = cmdq->current_state.idx) == -2) return (CMD_RETURN_ERROR); - src = cmdq->state.s; - dst = cmdq->state.s2; + src = cmdq->current_state.s; + dst = cmdq->current_state.s2; kflag = args_has(self->args, 'k'); dflag = args_has(self->args, 'd'); diff --git a/cmd-list-clients.c b/cmd-list-clients.c index f446407..84ab3a6 100644 --- a/cmd-list-clients.c +++ b/cmd-list-clients.c @@ -52,7 +52,7 @@ cmd_list_clients_exec(struct cmd *self, struct cmd_q *cmdq) u_int i; char *line; - s = cmdq->state.s; + s = cmdq->current_state.s; if (args_has(args, 't') && s == NULL) return (CMD_RETURN_ERROR); diff --git a/cmd-list-panes.c b/cmd-list-panes.c index fa64f27..4ce3873 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -52,10 +52,10 @@ 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); + cmdq->current_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); + cmdq->current_state.wl = cmd_find_window(cmdq, args_get(args, 't'), + &cmdq->current_state.s); } } @@ -66,7 +66,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_q *cmdq) struct session *s; struct winlink *wl; - s = cmdq->state.s; + s = cmdq->current_state.s; if (args_has(args, 'a')) cmd_list_panes_server(self, cmdq); @@ -75,7 +75,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); cmd_list_panes_session(self, s, cmdq, 1); } else { - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); cmd_list_panes_window(self, s, wl, cmdq, 0); } diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 9ad6df4..c7a674a 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -50,7 +50,7 @@ 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); + cmdq->current_state.s = cmd_find_session(cmdq, args_get(args, 't'), 0); } enum cmd_retval @@ -62,7 +62,7 @@ cmd_list_windows_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(args, 'a')) cmd_list_windows_server(self, cmdq); else { - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); cmd_list_windows_session(self, s, cmdq, 0); } diff --git a/cmd-lock-server.c b/cmd-lock-server.c index 4778365..6db7ef7 100644 --- a/cmd-lock-server.c +++ b/cmd-lock-server.c @@ -67,9 +67,9 @@ 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); + cmdq->current_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); + cmdq->current_state.c = cmd_find_client(cmdq, args_get(args, 't'), 0); } enum cmd_retval @@ -81,11 +81,11 @@ cmd_lock_server_exec(struct cmd *self, unused struct cmd_q *cmdq) if (self->entry == &cmd_lock_server_entry) server_lock(); else if (self->entry == &cmd_lock_session_entry) { - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); server_lock_session(s); } else { - if ((c = cmdq->state.c) == NULL) + if ((c = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); server_lock_client(c); } diff --git a/cmd-move-window.c b/cmd-move-window.c index 8e78a6d..f11519a 100644 --- a/cmd-move-window.c +++ b/cmd-move-window.c @@ -45,12 +45,12 @@ 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); + cmdq->current_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); + cmdq->current_state.wl = cmd_find_window(cmdq, args_get(args, 's'), + &cmdq->current_state.s); + cmdq->current_state.idx = cmd_find_index(cmdq, args_get(args, 't'), + &cmdq->current_state.s2); } } @@ -64,7 +64,7 @@ cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq) int idx, kflag, dflag; if (args_has(args, 'r')) { - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); session_renumber_windows(s); @@ -72,12 +72,12 @@ cmd_move_window_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } - src = cmdq->state.s; - dst = cmdq->state.s2; + src = cmdq->current_state.s; + dst = cmdq->current_state.s2; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - if ((idx = cmdq->state.idx) == -2) + if ((idx = cmdq->current_state.idx) == -2) return (CMD_RETURN_ERROR); kflag = args_has(self->args, 'k'); diff --git a/cmd-new-window.c b/cmd-new-window.c index 2a8a3e3..01cecfa 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -50,18 +50,18 @@ 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); + cmdq->current_state.wl = cmd_find_window(cmdq, args_get(args, 't'), + &cmdq->current_state.s); } else - cmd_find_index(cmdq, args_get(args, 't'), &cmdq->state.s); + cmd_find_index(cmdq, args_get(args, 't'), &cmdq->current_state.s); } enum cmd_retval cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq) { struct args *args = self->args; - struct session *s = cmdq->state.s; - struct winlink *wl = cmdq->state.wl; + struct session *s = cmdq->current_state.s; + struct winlink *wl = cmdq->current_state.wl; struct client *c; const char *cmd, *template; char *cause, *cp; diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c index 4823db2..f201308 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -54,10 +54,10 @@ cmd_paste_buffer_exec(struct cmd *self, struct cmd_q *cmdq) int buffer; int pflag; - if (cmdq->state.wl == NULL) + if (cmdq->current_state.wl == NULL) return (CMD_RETURN_ERROR); - wp = cmdq->state.wp; + wp = cmdq->current_state.wp; if (!args_has(args, 'b')) buffer = -1; diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index 10308a0..1726107 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -55,9 +55,9 @@ cmd_pipe_pane_exec(struct cmd *self, struct cmd_q *cmdq) char *command; int old_fd, pipe_fd[2], null_fd; - if (cmdq->state.wl == NULL) + if (cmdq->current_state.wl == NULL) return (CMD_RETURN_ERROR); - wp = cmdq->state.wp; + wp = cmdq->current_state.wp; c = cmd_find_client(cmdq, NULL, 1); /* Destroy the old pipe. */ diff --git a/cmd-queue.c b/cmd-queue.c index 2790a10..528b7d2 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -33,16 +33,16 @@ void cmdq_run_hook(struct hooks *, const char *, struct cmd *, void cmdq_set_state(struct cmd_q *cmdq) { - memset(&cmdq->state, 0, sizeof cmdq->state); + memset(&cmdq->current_state, 0, sizeof cmdq->current_state); - cmdq->state.c = cmdq->client; + cmdq->current_state.c = cmdq->client; - cmdq->state.s = cmdq->client != NULL ? cmdq->client->session : NULL; - cmdq->state.s2 = NULL; + cmdq->current_state.s = cmdq->client != NULL ? cmdq->client->session : NULL; + cmdq->current_state.s2 = NULL; - cmdq->state.w = NULL; - cmdq->state.wl = NULL; - cmdq->state.wp = NULL; + cmdq->current_state.w = NULL; + cmdq->current_state.wl = NULL; + cmdq->current_state.wp = NULL; } /* Create new command queue. */ @@ -266,8 +266,8 @@ cmdq_continue(struct cmd_q *cmdq) * otherwise used the intended session's hooks when * running the command. */ - if (cmdq->state.s != NULL) - hooks = &cmdq->state.s->hooks; + if (cmdq->current_state.s != NULL) + hooks = &cmdq->current_state.s->hooks; else hooks = &global_hooks; diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c index 8fb1a8d..46034f2 100644 --- a/cmd-refresh-client.c +++ b/cmd-refresh-client.c @@ -45,7 +45,7 @@ cmd_refresh_client_exec(struct cmd *self, struct cmd_q *cmdq) const char *size; u_int w, h; - if ((c = cmdq->state.c) == NULL) + if ((c = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); if (args_has(args, 'C')) { diff --git a/cmd-rename-session.c b/cmd-rename-session.c index bfc7b19..3377783 100644 --- a/cmd-rename-session.c +++ b/cmd-rename-session.c @@ -56,7 +56,7 @@ cmd_rename_session_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); } - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); RB_REMOVE(sessions, &sessions, s); diff --git a/cmd-rename-window.c b/cmd-rename-window.c index fcef5f8..b26cb4c 100644 --- a/cmd-rename-window.c +++ b/cmd-rename-window.c @@ -45,7 +45,7 @@ cmd_rename_window_exec(struct cmd *self, struct cmd_q *cmdq) struct args *args = self->args; struct winlink *wl; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); window_set_name(wl->window, args->argv[0]); diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index 888d256..c5fe646 100644 --- a/cmd-resize-pane.c +++ b/cmd-resize-pane.c @@ -98,10 +98,10 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq) u_int adjust; int x, y; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); w = wl->window; - wp = cmdq->state.wp; + wp = cmdq->current_state.wp; if (args_has(args, 'Z')) { if (w->flags & WINDOW_ZOOMED) diff --git a/cmd-respawn-pane.c b/cmd-respawn-pane.c index 14da4a7..663aefa 100644 --- a/cmd-respawn-pane.c +++ b/cmd-respawn-pane.c @@ -54,11 +54,11 @@ cmd_respawn_pane_exec(struct cmd *self, struct cmd_q *cmdq) char *cause; u_int idx; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); w = wl->window; - s = cmdq->state.s; - wp = cmdq->state.wp; + s = cmdq->current_state.s; + wp = cmdq->current_state.wp; if (!args_has(self->args, 'k') && wp->fd != -1) { if (window_pane_index(wp, &idx) != 0) diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c index fdafe9d..2033a54 100644 --- a/cmd-respawn-window.c +++ b/cmd-respawn-window.c @@ -52,10 +52,10 @@ cmd_respawn_window_exec(struct cmd *self, struct cmd_q *cmdq) const char *cmd; char *cause; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); w = wl->window; - s = cmdq->state.s; + s = cmdq->current_state.s; if (!args_has(self->args, 'k')) { TAILQ_FOREACH(wp, &w->panes, entry) { diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c index 3ba7265..9d6446f 100644 --- a/cmd-rotate-window.c +++ b/cmd-rotate-window.c @@ -55,7 +55,7 @@ cmd_rotate_window_exec(struct cmd *self, struct cmd_q *cmdq) struct layout_cell *lc; u_int sx, sy, xoff, yoff; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); w = wl->window; diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 39a4095..ed64aae 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -85,7 +85,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) struct format_tree *ft; if (args_has(args, 't')) - wl = cmdq->state.wl; + wl = cmdq->current_state.wl; else { c = cmd_find_client(cmdq, NULL, 1); if (c != NULL && c->session != NULL) { @@ -94,9 +94,9 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq) wp = wl->window->active; } } - s = cmdq->state.s; - wl = cmdq->state.wl; - wp = cmdq->state.wp; + s = cmdq->current_state.s; + wl = cmdq->current_state.wl; + wp = cmdq->current_state.wp; ft = format_create(); if (s != NULL) diff --git a/cmd-select-layout.c b/cmd-select-layout.c index 6799386..a970c34 100644 --- a/cmd-select-layout.c +++ b/cmd-select-layout.c @@ -91,7 +91,7 @@ cmd_select_layout_exec(struct cmd *self, struct cmd_q *cmdq) const char *layoutname; int next, previous, layout; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); server_unzoom_window(wl->window); diff --git a/cmd-select-pane.c b/cmd-select-pane.c index e62f298..20c9b84 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -70,11 +70,11 @@ 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'), + cmdq->current_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); + cmdq->current_state.wl = cmd_find_pane(cmdq, args_get(args, 't'), NULL, + &cmdq->current_state.wp); } } @@ -86,7 +86,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq) struct window_pane *wp; if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) { - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); if (wl->window->last == NULL) { @@ -102,10 +102,10 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - wp = cmdq->state.wp; + wp = cmdq->current_state.wp; server_unzoom_window(wp->window); if (!window_pane_visible(wp)) { diff --git a/cmd-select-window.c b/cmd-select-window.c index 5515ce9..66ba236 100644 --- a/cmd-select-window.c +++ b/cmd-select-window.c @@ -101,10 +101,10 @@ cmd_select_window_prepare(struct cmd *self, struct cmd_q *cmdq) last = 1; if (next || previous || last) - cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0); + cmdq->current_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); + cmdq->current_state.wl = cmd_find_window(cmdq, args_get(args, 't'), + &cmdq->current_state.s); } } @@ -126,7 +126,7 @@ cmd_select_window_exec(struct cmd *self, struct cmd_q *cmdq) last = 1; if (next || previous || last) { - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); activity = args_has(self->args, 'a'); @@ -149,9 +149,9 @@ cmd_select_window_exec(struct cmd *self, struct cmd_q *cmdq) server_redraw_session(s); } else { - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - s = cmdq->state.s; + s = cmdq->current_state.s; /* * If -T and select-window is invoked on same window as diff --git a/cmd-send-keys.c b/cmd-send-keys.c index d3f73ca..8e3bff0 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -60,10 +60,10 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq) const u_char *str; int i, key; - if (cmdq->state.wl == NULL) + if (cmdq->current_state.wl == NULL) return (CMD_RETURN_ERROR); - s = cmdq->state.s; - wp = cmdq->state.wp; + s = cmdq->current_state.s; + wp = cmdq->current_state.wp; if (self->entry == &cmd_send_prefix_entry) { if (args_has(args, '2')) diff --git a/cmd-set-environment.c b/cmd-set-environment.c index e70818a..0045516 100644 --- a/cmd-set-environment.c +++ b/cmd-set-environment.c @@ -66,7 +66,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(self->args, 'g')) env = &global_environ; else { - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); env = &s->environ; } diff --git a/cmd-set-hook.c b/cmd-set-hook.c index bdf4540..6879d63 100644 --- a/cmd-set-hook.c +++ b/cmd-set-hook.c @@ -51,7 +51,7 @@ cmd_set_hook_exec(struct cmd *self, struct cmd_q *cmdq) char *cause; const char *name, *cmd; - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); hooks = args_has(args, 'g') ? &global_hooks : &s->hooks; diff --git a/cmd-show-environment.c b/cmd-show-environment.c index 7bd0c60..66fcb74 100644 --- a/cmd-show-environment.c +++ b/cmd-show-environment.c @@ -51,7 +51,7 @@ cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(self->args, 'g')) env = &global_environ; else { - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); env = &s->environ; } diff --git a/cmd-show-hooks.c b/cmd-show-hooks.c index ea14631..b3e87bd 100644 --- a/cmd-show-hooks.c +++ b/cmd-show-hooks.c @@ -50,7 +50,7 @@ cmd_show_hooks_exec(struct cmd *self, struct cmd_q *cmdq) char tmp[BUFSIZ]; size_t used; - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); hooks = args_has(args, 'g') ? &global_hooks : &s->hooks; diff --git a/cmd-show-messages.c b/cmd-show-messages.c index de3daf6..934d640 100644 --- a/cmd-show-messages.c +++ b/cmd-show-messages.c @@ -157,7 +157,7 @@ cmd_show_messages_exec(unused struct cmd *self, struct cmd_q *cmdq) if (done) return (CMD_RETURN_NORMAL); - if ((c = cmdq->state.c) == NULL) + if ((c = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); for (i = 0; i < ARRAY_LENGTH(&c->message_log); i++) { diff --git a/cmd-show-options.c b/cmd-show-options.c index c9c731f..62ae689 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -62,10 +62,10 @@ cmd_show_options_prepare(struct cmd *self, struct cmd_q *cmdq) 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'), + cmdq->current_state.wl = cmd_find_window(cmdq, args_get(args, 't'), NULL); } else - cmdq->state.s = cmd_find_session(cmdq, args_get(args, 't'), 0); + cmdq->current_state.s = cmd_find_session(cmdq, args_get(args, 't'), 0); } enum cmd_retval @@ -87,7 +87,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(self->args, 'g')) oo = &global_w_options; else { - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); oo = &wl->window->options; } @@ -96,7 +96,7 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq) if (args_has(self->args, 'g')) oo = &global_s_options; else { - if ((s = cmdq->state.s) == NULL) + if ((s = cmdq->current_state.s) == NULL) return (CMD_RETURN_ERROR); oo = &s->options; } diff --git a/cmd-split-window.c b/cmd-split-window.c index ac07e33..b3dbbe4 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -71,11 +71,11 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq) struct client *c; struct format_tree *ft; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); w = wl->window; - s = cmdq->state.s; - wp = cmdq->state.wp; + s = cmdq->current_state.s; + wp = cmdq->current_state.wp; server_unzoom_window(w); environ_init(&env); diff --git a/cmd-suspend-client.c b/cmd-suspend-client.c index c101dc5..c045d01 100644 --- a/cmd-suspend-client.c +++ b/cmd-suspend-client.c @@ -45,7 +45,7 @@ cmd_suspend_client_exec(unused struct cmd *self, struct cmd_q *cmdq) { struct client *c; - if ((c = cmdq->state.c) == NULL) + if ((c = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); tty_stop_tty(&c->tty); diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index 958593a..89d2cd3 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -60,10 +60,10 @@ cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq) struct layout_cell *src_lc, *dst_lc; u_int sx, sy, xoff, yoff; - if ((dst_wl = cmdq->state.wl) == NULL) + if ((dst_wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); dst_w = dst_wl->window; - dst_wp = cmdq->state.wp; + dst_wp = cmdq->current_state.wp; server_unzoom_window(dst_w); if (!args_has(args, 's')) { diff --git a/cmd-swap-window.c b/cmd-swap-window.c index 2e56f1b..7cac4f0 100644 --- a/cmd-swap-window.c +++ b/cmd-swap-window.c @@ -44,10 +44,10 @@ 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); + cmdq->current_state.wl = cmd_find_window(cmdq, args_get(args, 's'), + &cmdq->current_state.s); + cmdq->current_state.wl2 = cmd_find_window(cmdq, args_get(args, 't'), + &cmdq->current_state.s2); } enum cmd_retval @@ -58,12 +58,12 @@ cmd_swap_window_exec(struct cmd *self, struct cmd_q *cmdq) struct winlink *wl_src, *wl_dst; struct window *w; - if ((wl_src = cmdq->state.wl) == NULL) + if ((wl_src = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); - src = cmdq->state.s; - if ((wl_dst = cmdq->state.wl2) == NULL) + src = cmdq->current_state.s; + if ((wl_dst = cmdq->current_state.wl2) == NULL) return (CMD_RETURN_ERROR); - dst = cmdq->state.s2; + dst = cmdq->current_state.s2; sg_src = session_group_find(src); sg_dst = session_group_find(dst); diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 48a5cd6..12d89de 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -63,8 +63,8 @@ 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); + cmdq->current_state.c = cmd_find_client(cmdq, args_get(args, 'c'), 0); + cmdq->current_state.s = cmd_find_session(cmdq, args_get(args, 't'), 0); } enum cmd_retval @@ -78,7 +78,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 = cmdq->current_state.c) == NULL) return (CMD_RETURN_ERROR); if (args_has(args, 'r')) { diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c index 8708e1f..95b0f35 100644 --- a/cmd-unlink-window.c +++ b/cmd-unlink-window.c @@ -46,10 +46,10 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_q *cmdq) struct session_group *sg; u_int references; - if ((wl = cmdq->state.wl) == NULL) + if ((wl = cmdq->current_state.wl) == NULL) return (CMD_RETURN_ERROR); w = wl->window; - s = cmdq->state.s; + s = cmdq->current_state.s; sg = session_group_find(s); if (sg != NULL) { diff --git a/cmd.c b/cmd.c index 1130536..c62ff8a 100644 --- a/cmd.c +++ b/cmd.c @@ -296,9 +296,9 @@ cmd_prepare(struct cmd *cmd, struct cmd_q *cmdq) { struct args *args = cmd->args; const char *tflag = args_get(args, 't'); - struct cmd_state *state = &cmdq->state; + struct cmd_state *state = &cmdq->current_state; - cmdq->state.c = cmd_current_client(cmdq); + cmdq->current_state.c = cmd_current_client(cmdq); if (cmd->entry->flags & CMD_PREPARESESSION) state->s = cmd_find_session(cmdq, tflag, 1); diff --git a/tmux.h b/tmux.h index 26303a8..194529d 100644 --- a/tmux.h +++ b/tmux.h @@ -1436,7 +1436,8 @@ struct cmd_q { struct cmd_q_items queue; struct cmd_q_item *item; struct cmd *cmd; - struct cmd_state state; + struct cmd_state default_state; + struct cmd_state current_state; time_t time; u_int number; ----------------------------------------------------------------------- Summary of changes: cmd-break-pane.c | 6 +++--- cmd-capture-pane.c | 2 +- cmd-choose-buffer.c | 4 ++-- cmd-choose-client.c | 4 ++-- cmd-choose-list.c | 4 ++-- cmd-choose-tree.c | 6 +++--- cmd-clear-history.c | 2 +- cmd-clock-mode.c | 2 +- cmd-command-prompt.c | 2 +- cmd-confirm-before.c | 2 +- cmd-copy-mode.c | 2 +- cmd-detach-client.c | 8 ++++---- cmd-display-message.c | 20 ++++++++++---------- cmd-display-panes.c | 2 +- cmd-find-window.c | 4 ++-- cmd-has-session.c | 2 +- cmd-if-shell.c | 14 +++++++------- cmd-join-pane.c | 18 +++++++++--------- cmd-kill-pane.c | 4 ++-- cmd-kill-session.c | 2 +- cmd-kill-window.c | 4 ++-- cmd-link-window.c | 16 ++++++++-------- cmd-list-clients.c | 2 +- cmd-list-panes.c | 10 +++++----- cmd-list-windows.c | 4 ++-- cmd-lock-server.c | 8 ++++---- cmd-move-window.c | 20 ++++++++++---------- cmd-new-window.c | 10 +++++----- cmd-paste-buffer.c | 4 ++-- cmd-pipe-pane.c | 4 ++-- cmd-queue.c | 18 +++++++++--------- cmd-refresh-client.c | 2 +- cmd-rename-session.c | 2 +- cmd-rename-window.c | 2 +- cmd-resize-pane.c | 4 ++-- cmd-respawn-pane.c | 6 +++--- cmd-respawn-window.c | 4 ++-- cmd-rotate-window.c | 2 +- cmd-run-shell.c | 8 ++++---- cmd-select-layout.c | 2 +- cmd-select-pane.c | 12 ++++++------ cmd-select-window.c | 12 ++++++------ cmd-send-keys.c | 6 +++--- cmd-set-environment.c | 2 +- cmd-set-hook.c | 2 +- cmd-show-environment.c | 2 +- cmd-show-hooks.c | 2 +- cmd-show-messages.c | 2 +- cmd-show-options.c | 8 ++++---- cmd-split-window.c | 6 +++--- cmd-suspend-client.c | 2 +- cmd-swap-pane.c | 4 ++-- cmd-swap-window.c | 16 ++++++++-------- cmd-switch-client.c | 6 +++--- cmd-unlink-window.c | 4 ++-- cmd.c | 4 ++-- tmux.h | 3 ++- 57 files changed, 168 insertions(+), 167 deletions(-) hooks/post-receive -- tmux ------------------------------------------------------------------------------ Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce. With Perforce, you get hassle-free workflows. Merge that actually works. Faster operations. Version large binaries. Built-in WAN optimization and the freedom to use Git, Perforce or both. Make the move to Perforce. http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk _______________________________________________ tmux-cvs mailing list tmux-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-cvs