diff options
Diffstat (limited to 'cmd-select-pane.c')
-rw-r--r-- | cmd-select-pane.c | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/cmd-select-pane.c b/cmd-select-pane.c index c63c7e61..224370ab 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -83,19 +83,20 @@ cmd_select_pane_redraw(struct window *w) static enum cmd_retval cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item) { - struct args *args = self->args; - struct cmd_find_state *current = &item->shared->current; - struct client *c = cmd_find_client(item, NULL, 1); - struct winlink *wl = item->target.wl; + struct args *args = cmd_get_args(self); + const struct cmd_entry *entry = cmd_get_entry(self); + struct cmd_find_state *current = cmdq_get_current(item); + struct cmd_find_state *target = cmdq_get_target(item); + struct winlink *wl = target->wl; struct window *w = wl->window; - struct session *s = item->target.s; - struct window_pane *wp = item->target.wp, *lastwp, *markedwp; - char *pane_title; + struct session *s = target->s; + struct window_pane *wp = target->wp, *lastwp, *markedwp; + struct options *oo = wp->options; + char *title; const char *style; - struct style *sy; struct options_entry *o; - if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) { + if (entry == &cmd_last_pane_entry || args_has(args, 'l')) { lastwp = w->last; if (lastwp == NULL && window_count_panes(w) == 2) { lastwp = TAILQ_PREV(w->active, window_panes, entry); @@ -106,12 +107,12 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item) cmdq_error(item, "no last pane"); return (CMD_RETURN_ERROR); } - if (args_has(self->args, 'e')) + if (args_has(args, 'e')) lastwp->flags &= ~PANE_INPUTOFF; - else if (args_has(self->args, 'd')) + else if (args_has(args, 'd')) lastwp->flags |= PANE_INPUTOFF; else { - if (window_push_zoom(w, args_has(self->args, 'Z'))) + if (window_push_zoom(w, args_has(args, 'Z'))) server_redraw_window(w); window_redraw_active_switch(w, lastwp); if (window_set_active_pane(w, lastwp, 1)) { @@ -146,38 +147,34 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_NORMAL); } - if (args_has(self->args, 'P') || args_has(self->args, 'g')) { - if ((style = args_get(args, 'P')) != NULL) { - o = options_set_style(wp->options, "window-style", 0, - style); - if (o == NULL) { - cmdq_error(item, "bad style: %s", style); - return (CMD_RETURN_ERROR); - } - options_set_style(wp->options, "window-active-style", 0, - style); - wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED); - } - if (args_has(self->args, 'g')) { - sy = options_get_style(wp->options, "window-style"); - cmdq_print(item, "%s", style_tostring(sy)); + style = args_get(args, 'P'); + if (style != NULL) { + o = options_set_string(oo, "window-style", 0, "%s", style); + if (o == NULL) { + cmdq_error(item, "bad style: %s", style); + return (CMD_RETURN_ERROR); } + options_set_string(oo, "window-active-style", 0, "%s", style); + wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED); + } + if (args_has(args, 'g')) { + cmdq_print(item, "%s", options_get_string(oo, "window-style")); return (CMD_RETURN_NORMAL); } - if (args_has(self->args, 'L')) { + if (args_has(args, 'L')) { window_push_zoom(w, 1); wp = window_pane_find_left(wp); window_pop_zoom(w); - } else if (args_has(self->args, 'R')) { + } else if (args_has(args, 'R')) { window_push_zoom(w, 1); wp = window_pane_find_right(wp); window_pop_zoom(w); - } else if (args_has(self->args, 'U')) { + } else if (args_has(args, 'U')) { window_push_zoom(w, 1); wp = window_pane_find_up(wp); window_pop_zoom(w); - } else if (args_has(self->args, 'D')) { + } else if (args_has(args, 'D')) { window_push_zoom(w, 1); wp = window_pane_find_down(wp); window_pop_zoom(w); @@ -185,27 +182,28 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item) if (wp == NULL) return (CMD_RETURN_NORMAL); - if (args_has(self->args, 'e')) { + if (args_has(args, 'e')) { wp->flags &= ~PANE_INPUTOFF; return (CMD_RETURN_NORMAL); } - if (args_has(self->args, 'd')) { + if (args_has(args, 'd')) { wp->flags |= PANE_INPUTOFF; return (CMD_RETURN_NORMAL); } - if (args_has(self->args, 'T')) { - pane_title = format_single(item, args_get(self->args, 'T'), - c, s, wl, wp); - if (screen_set_title(&wp->base, pane_title)) + if (args_has(args, 'T')) { + title = format_single_from_target(item, args_get(args, 'T')); + if (screen_set_title(&wp->base, title)) { + server_redraw_window_borders(wp->window); server_status_window(wp->window); - free(pane_title); + } + free(title); return (CMD_RETURN_NORMAL); } if (wp == w->active) return (CMD_RETURN_NORMAL); - if (window_push_zoom(w, args_has(self->args, 'Z'))) + if (window_push_zoom(w, args_has(args, 'Z'))) server_redraw_window(w); window_redraw_active_switch(w, wp); if (window_set_active_pane(w, wp, 1)) { |