diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-04-19 21:05:28 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2015-04-19 21:05:28 +0000 |
commit | fb36becc81957f91d6731e0138a72f45adf221cd (patch) | |
tree | 490d32fc0fca98b9413ea842360e8f5b52395111 /usr.bin/tmux/cmd-select-pane.c | |
parent | 5f8089449652b88b9974ed71ecf453be1bef6f2d (diff) |
Support setting the default window and pane background colours (window
and active pane via window-style and window-active-style options, an
individual pane by a new select-pane -P flag). From J Raynor.
Diffstat (limited to 'usr.bin/tmux/cmd-select-pane.c')
-rw-r--r-- | usr.bin/tmux/cmd-select-pane.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-select-pane.c b/usr.bin/tmux/cmd-select-pane.c index f699941d322..efaac9a38ed 100644 --- a/usr.bin/tmux/cmd-select-pane.c +++ b/usr.bin/tmux/cmd-select-pane.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-select-pane.c,v 1.20 2014/10/21 22:22:04 nicm Exp $ */ +/* $OpenBSD: cmd-select-pane.c,v 1.21 2015/04/19 21:05:27 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -28,8 +28,8 @@ enum cmd_retval cmd_select_pane_exec(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, + "DdegLlP:Rt:U", 0, 0, + "[-DdegLlRU] [-P style] " CMD_TARGET_PANE_USAGE, 0, cmd_select_pane_exec }; @@ -48,6 +48,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq) struct args *args = self->args; struct winlink *wl; struct window_pane *wp; + const char *style; if (self->entry == &cmd_last_pane_entry || args_has(args, 'l')) { wl = cmd_find_window(cmdq, args_get(args, 't'), NULL); @@ -82,6 +83,21 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); } + if (args_has(self->args, 'P') || args_has(self->args, 'g')) { + if (args_has(args, 'P')) { + style = args_get(args, 'P'); + if (style_parse(&grid_default_cell, &wp->colgc, + style) == -1) { + cmdq_error(cmdq, "bad style: %s", style); + return (CMD_RETURN_ERROR); + } + wp->flags |= PANE_REDRAW; + } + if (args_has(self->args, 'g')) + cmdq_print(cmdq, "%s", style_tostring(&wp->colgc)); + return (CMD_RETURN_NORMAL); + } + if (args_has(self->args, 'L')) wp = window_pane_find_left(wp); else if (args_has(self->args, 'R')) |