summaryrefslogtreecommitdiffstats
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2019-06-20 11:59:59 +0000
committernicm <nicm>2019-06-20 11:59:59 +0000
commit5f92f92908b81b4ec66682adb84b9ffc8d83c2f7 (patch)
tree1efeb76d391658d00d7b6028ae02b2cf49a5cac6 /tty.c
parentc1ede507d954b98a73c40665e7aee6fe5f0c5bce (diff)
Add a per-pane option set. Pane options inherit from window options (so
there should be no change to existing behaviour) and are set and shown with set-option -p and show-options -p. Change remain-on-exit and window-style/window-active-style to be pane options (some others will be changed later). This makes select-pane -P and -g unnecessary so no longer document them (they still work) and no longer document set-window-option and show-window-options in favour of set-option -w and show-options -w.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/tty.c b/tty.c
index 05df4f0f..8d3b2858 100644
--- a/tty.c
+++ b/tty.c
@@ -2132,7 +2132,7 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
/* Ignore cell if it is the same as the last one. */
if (wp != NULL &&
(int)wp->id == tty->last_wp &&
- ~(wp->window->flags & WINDOW_STYLECHANGED) &&
+ ~(wp->flags & PANE_STYLECHANGED) &&
gc->attr == tty->last_cell.attr &&
gc->fg == tty->last_cell.fg &&
gc->bg == tty->last_cell.bg)
@@ -2514,30 +2514,28 @@ fallback_256:
static void
tty_default_colours(struct grid_cell *gc, struct window_pane *wp)
{
- struct window *w = wp->window;
- struct options *oo = w->options;
- struct style *active, *pane, *window;
- int c;
-
- if (w->flags & WINDOW_STYLECHANGED) {
- w->flags &= ~WINDOW_STYLECHANGED;
- active = options_get_style(oo, "window-active-style");
- style_copy(&w->active_style, active);
- window = options_get_style(oo, "window-style");
- style_copy(&w->style, window);
+ struct options *oo = wp->options;
+ struct style *style, *active_style;
+ int c;
+
+ if (wp->flags & PANE_STYLECHANGED) {
+ wp->flags &= ~PANE_STYLECHANGED;
+
+ active_style = options_get_style(oo, "window-active-style");
+ style = options_get_style(oo, "window-style");
+
+ style_copy(&wp->cached_active_style, active_style);
+ style_copy(&wp->cached_style, style);
} else {
- active = &w->active_style;
- window = &w->style;
+ active_style = &wp->cached_active_style;
+ style = &wp->cached_style;
}
- pane = &wp->style;
if (gc->fg == 8) {
- if (pane->gc.fg != 8)
- gc->fg = pane->gc.fg;
- else if (wp == w->active && active->gc.fg != 8)
- gc->fg = active->gc.fg;
+ if (wp == wp->window->active && active_style->gc.fg != 8)
+ gc->fg = active_style->gc.fg;
else
- gc->fg = window->gc.fg;
+ gc->fg = style->gc.fg;
if (gc->fg != 8) {
c = window_pane_get_palette(wp, gc->fg);
@@ -2547,12 +2545,10 @@ tty_default_colours(struct grid_cell *gc, struct window_pane *wp)
}
if (gc->bg == 8) {
- if (pane->gc.bg != 8)
- gc->bg = pane->gc.bg;
- else if (wp == w->active && active->gc.bg != 8)
- gc->bg = active->gc.bg;
+ if (wp == wp->window->active && active_style->gc.bg != 8)
+ gc->bg = active_style->gc.bg;
else
- gc->bg = window->gc.bg;
+ gc->bg = style->gc.bg;
if (gc->bg != 8) {
c = window_pane_get_palette(wp, gc->bg);