diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/cmd-set-option.c | 7 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 6 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 37 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 4 |
4 files changed, 36 insertions, 18 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index 9a46343710d..dfda82df2ef 100644 --- a/usr.bin/tmux/cmd-set-option.c +++ b/usr.bin/tmux/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.95 2016/04/29 15:00:48 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.96 2016/05/30 09:50:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -200,6 +200,11 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq) status_timer_start_all(); if (strcmp(oe->name, "monitor-silence") == 0) alerts_reset_all(); + if (strcmp(oe->name, "window-style") == 0 || + strcmp(oe->name, "window-active-style") == 0) { + RB_FOREACH(w, windows, &windows) + w->flags |= WINDOW_STYLECHANGED; + } /* When the pane-border-status option has been changed, resize panes. */ if (strcmp(oe->name, "pane-border-status") == 0) { diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 233cb20f987..7eb74f75bde 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.631 2016/05/27 17:05:42 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.632 2016/05/30 09:50:20 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -943,10 +943,14 @@ struct window { #define WINDOW_ZOOMED 0x1000 #define WINDOW_FORCEWIDTH 0x2000 #define WINDOW_FORCEHEIGHT 0x4000 +#define WINDOW_STYLECHANGED 0x8000 #define WINDOW_ALERTFLAGS (WINDOW_BELL|WINDOW_ACTIVITY|WINDOW_SILENCE) struct options *options; + struct grid_cell style; + struct grid_cell active_style; + u_int references; RB_ENTRY(window) entry; diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index f30d7db0214..550f7713338 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.202 2016/05/30 09:26:49 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.203 2016/05/30 09:50:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -676,7 +676,8 @@ tty_fake_bce(const struct tty *tty, const struct window_pane *wp) struct grid_cell gc; memcpy(&gc, &grid_default_cell, sizeof gc); - tty_default_colours(&gc, wp); + if (wp != NULL) + tty_default_colours(&gc, wp); if (gc.bg == 8 && !(gc.flags & GRID_FLAG_BG256)) return (0); @@ -1133,10 +1134,10 @@ tty_cmd_cell(struct tty *tty, const struct tty_ctx *ctx) { struct window_pane *wp = ctx->wp; struct screen *s = wp->screen; - u_int cx; - u_int width; + u_int cx, width; - tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); + if (ctx->ocy == ctx->orlower) + tty_region_pane(tty, ctx, ctx->orupper, ctx->orlower); /* Is the cursor in the very last position? */ width = ctx->cell->data.width; @@ -1443,7 +1444,8 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc, u_char changed; memcpy(&gc2, gc, sizeof gc2); - tty_default_colours(&gc2, wp); + if (wp != NULL) + tty_default_colours(&gc2, wp); /* * If no setab, try to use the reverse attribute as a best-effort for a @@ -1793,20 +1795,27 @@ tty_try_rgb(struct tty *tty, const struct grid_cell_rgb *rgb, const char *type) void tty_default_colours(struct grid_cell *gc, const struct window_pane *wp) { - const struct grid_cell *agc, *pgc, *wgc; - - if (wp == NULL) - return; + struct window *w = wp->window; + struct options *oo = w->options; + const struct grid_cell *agc, *pgc, *wgc; + if (w->flags & WINDOW_STYLECHANGED) { + w->flags &= ~WINDOW_STYLECHANGED; + agc = options_get_style(oo, "window-active-style"); + memcpy(&w->active_style, agc, sizeof w->active_style); + wgc = options_get_style(oo, "window-style"); + memcpy(&w->style, wgc, sizeof w->style); + } else { + agc = &w->active_style; + wgc = &w->style; + } pgc = &wp->colgc; - agc = options_get_style(wp->window->options, "window-active-style"); - wgc = options_get_style(wp->window->options, "window-style"); if (gc->fg == 8 && !(gc->flags & GRID_FLAG_FG256)) { if (pgc->fg != 8 || (pgc->flags & GRID_FLAG_FG256)) { gc->fg = pgc->fg; gc->flags |= (pgc->flags & GRID_FLAG_FG256); - } else if (wp == wp->window->active && + } else if (wp == w->active && (agc->fg != 8 || (agc->flags & GRID_FLAG_FG256))) { gc->fg = agc->fg; gc->flags |= (agc->flags & GRID_FLAG_FG256); @@ -1820,7 +1829,7 @@ tty_default_colours(struct grid_cell *gc, const struct window_pane *wp) if (pgc->bg != 8 || (pgc->flags & GRID_FLAG_BG256)) { gc->bg = pgc->bg; gc->flags |= (pgc->flags & GRID_FLAG_BG256); - } else if (wp == wp->window->active && + } else if (wp == w->active && (agc->bg != 8 || (agc->flags & GRID_FLAG_BG256))) { gc->bg = agc->bg; gc->flags |= (agc->flags & GRID_FLAG_BG256); diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index d38dddfd186..238d5ee0fae 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.159 2016/04/29 15:00:48 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.160 2016/05/30 09:50:21 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -291,7 +291,7 @@ window_create1(u_int sx, u_int sy) w = xcalloc(1, sizeof *w); w->name = NULL; - w->flags = 0; + w->flags = WINDOW_STYLECHANGED; TAILQ_INIT(&w->panes); w->active = NULL; |