Add window-pane-status-format options and adjust the default second

status line to show panes, also change how window-style is checked now
it is a pane option.
This commit is contained in:
nicm
2026-05-27 18:57:10 +00:00
parent 84d016ddcf
commit ee67452772
4 changed files with 68 additions and 42 deletions

61
tty.c
View File

@@ -2906,41 +2906,42 @@ tty_window_default_style(struct grid_cell *gc, struct window_pane *wp)
gc->bg = wp->palette.bg;
}
void
tty_default_colours(struct grid_cell *gc, struct window_pane *wp)
static void
tty_style_changed(struct window_pane *wp)
{
struct options *oo = wp->options;
struct format_tree *ft;
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", ft);
tty_window_default_style(&wp->cached_gc, wp);
style_add(&wp->cached_gc, oo, "window-style", ft);
format_free(ft);
}
void
tty_default_colours(struct grid_cell *gc, struct window_pane *wp)
{
if (wp->flags & PANE_STYLECHANGED)
tty_style_changed (wp);
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", ft);
tty_window_default_style(&wp->cached_gc, wp);
style_add(&wp->cached_gc, oo, "window-style", ft);
format_free(ft);
}
if (gc->fg == 8) {
if (wp == wp->window->active && wp->cached_active_gc.fg != 8)
gc->fg = wp->cached_active_gc.fg;
else
gc->fg = wp->cached_gc.fg;
}
if (gc->bg == 8) {
if (wp == wp->window->active && wp->cached_active_gc.bg != 8)
gc->bg = wp->cached_active_gc.bg;
else
gc->bg = wp->cached_gc.bg;
}
if (wp == wp->window->active && wp->cached_active_gc.fg != 8)
gc->fg = wp->cached_active_gc.fg;
else
gc->fg = wp->cached_gc.fg;
if (wp == wp->window->active && wp->cached_active_gc.bg != 8)
gc->bg = wp->cached_active_gc.bg;
else
gc->bg = wp->cached_gc.bg;
}
void