From e8a9c023f2e3eb15a7935fbfc177cd2c3df27c93 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 12 Aug 2021 19:47:05 +0000 Subject: [PATCH] Evaluate styles with the pane variables. --- usr.bin/tmux/cmd-select-pane.c | 4 +++- usr.bin/tmux/format.c | 11 +++++------ usr.bin/tmux/tty.c | 15 ++++++++++----- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/usr.bin/tmux/cmd-select-pane.c b/usr.bin/tmux/cmd-select-pane.c index 467331fe011..de9a381b7dc 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.66 2021/03/11 06:31:05 nicm Exp $ */ +/* $OpenBSD: cmd-select-pane.c,v 1.67 2021/08/12 19:47:05 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -145,10 +145,12 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item) markedwp = marked_pane.wp; if (lastwp != NULL) { + lastwp->flags |= (PANE_REDRAW|PANE_STYLECHANGED); server_redraw_window_borders(lastwp->window); server_status_window(lastwp->window); } if (markedwp != NULL) { + markedwp->flags |= (PANE_REDRAW|PANE_STYLECHANGED); server_redraw_window_borders(markedwp->window); server_status_window(markedwp->window); } diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 228a38c32fe..61106c23c65 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.290 2021/08/12 08:10:20 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.291 2021/08/12 19:47:05 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -4300,15 +4300,14 @@ format_replace(struct format_expand_state *es, const char *key, size_t keylen, if (strcmp(found, condition) == 0) { free(found); found = xstrdup(""); - format_log(es, "condition '%s' found: %s", - condition, found); - } else { format_log(es, "condition '%s' not found; assuming false", condition); } - } else - format_log(es, "condition '%s' found", condition); + } else { + format_log(es, "condition '%s' found: %s", condition, + found); + } if (format_choose(es, cp + 1, &left, &right, 0) != 0) { format_log(es, "condition '%s' syntax error: %s", diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index e475a47abd7..f1cdc2231d8 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.399 2021/08/11 20:49:55 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.400 2021/08/12 19:47:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2790,18 +2790,23 @@ tty_window_default_style(struct grid_cell *gc, struct window_pane *wp) void tty_default_colours(struct grid_cell *gc, struct window_pane *wp) { - struct options *oo = wp->options; + struct options *oo = wp->options; + struct format_tree *ft; memcpy(gc, &grid_default_cell, sizeof *gc); if (wp->flags & PANE_STYLECHANGED) { + log_debug("%%%u: style changed", wp->id); wp->flags &= ~PANE_STYLECHANGED; + ft = format_create(NULL, NULL, FORMAT_PANE|wp->id, + FORMAT_NOJOBS); + format_defaults(ft, NULL, NULL, NULL, wp); tty_window_default_style(&wp->cached_active_gc, wp); - style_add(&wp->cached_active_gc, oo, "window-active-style", - NULL); + style_add(&wp->cached_active_gc, oo, "window-active-style", ft); tty_window_default_style(&wp->cached_gc, wp); - style_add(&wp->cached_gc, oo, "window-style", NULL); + style_add(&wp->cached_gc, oo, "window-style", ft); + format_free(ft); } if (gc->fg == 8) { -- 2.20.1