summaryrefslogtreecommitdiffstats
path: root/cmd-select-pane.c
diff options
context:
space:
mode:
authornicm <nicm>2015-04-19 21:05:27 +0000
committernicm <nicm>2015-04-19 21:05:27 +0000
commitee123c248951450100475717f5bd45f292d9bb4d (patch)
tree84a865000a9d0ba60d891114c88f6d36c283b5c3 /cmd-select-pane.c
parent4a7587931ce54aa1a94a104480113d658c295b6b (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 'cmd-select-pane.c')
-rw-r--r--cmd-select-pane.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index 5810eeab..c84b4149 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -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'))