Merge branch 'master' into floating_panes

This commit is contained in:
Nicholas Marriott
2026-05-27 20:27:48 +01:00
3 changed files with 40 additions and 63 deletions

View File

@@ -1239,7 +1239,7 @@ const struct options_table_entry options_table[] = {
{ .name = "floating-pane-border-style", { .name = "floating-pane-border-style",
.type = OPTIONS_TABLE_STRING, .type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW, .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
.default_str = "default", .default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE, .flags = OPTIONS_TABLE_IS_STYLE,
.separator = ",", .separator = ",",
@@ -1250,7 +1250,7 @@ const struct options_table_entry options_table[] = {
{ .name = "floating-pane-style", { .name = "floating-pane-style",
.type = OPTIONS_TABLE_STRING, .type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW, .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
.default_str = "default", .default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE, .flags = OPTIONS_TABLE_IS_STYLE,
.separator = ",", .separator = ",",

View File

@@ -603,11 +603,9 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp,
border_option = "pane-active-border-style"; border_option = "pane-active-border-style";
else else
border_option = "pane-border-style"; border_option = "pane-border-style";
style_apply(&gc, w->options, border_option, ft); style_apply(&gc, wp->options, border_option, ft);
if (wp->flags & PANE_FLOATING) if (wp->flags & PANE_FLOATING)
style_add(&gc, w->options, "floating-pane-border-style", ft); style_add(&gc, wp->options, "floating-pane-border-style", ft);
if (options_get_only(wp->options, border_option) != NULL)
style_add(&gc, wp->options, border_option, ft);
fmt = options_get_string(wp->options, "pane-border-format"); fmt = options_get_string(wp->options, "pane-border-format");
expanded = format_expand_time(ft, fmt); expanded = format_expand_time(ft, fmt);
@@ -874,7 +872,6 @@ screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x,
{ {
struct client *c = ctx->c; struct client *c = ctx->c;
struct session *s = c->session; struct session *s = c->session;
struct window *w = s->curw->window;
struct window_pane *active = server_client_get_pane(c); struct window_pane *active = server_client_get_pane(c);
struct grid_cell *gc; struct grid_cell *gc;
const char *border_option; const char *border_option;
@@ -893,11 +890,7 @@ screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x,
if (!*flag) { if (!*flag) {
ft = format_create_defaults(NULL, c, s, s->curw, wp); ft = format_create_defaults(NULL, c, s, s->curw, wp);
style_apply(gc, wp->options, border_option, ft);
style_apply(gc, w->options, border_option, ft);
if (options_get_only(wp->options, border_option) != NULL)
style_add(gc, wp->options, border_option, ft);
format_free(ft); format_free(ft);
*flag = 1; *flag = 1;
} }

48
tty.c
View File

@@ -3199,62 +3199,46 @@ tty_window_default_style(struct grid_cell *gc, struct window_pane *wp)
gc->bg = wp->palette.bg; gc->bg = wp->palette.bg;
} }
void static void
tty_default_colours(struct grid_cell *gc, struct window_pane *wp) tty_style_changed(struct window_pane *wp)
{ {
struct window *w = wp->window; struct options *oo = wp->options;
struct options *wo = w->options;
struct format_tree *ft; struct format_tree *ft;
memcpy(gc, &grid_default_cell, sizeof *gc);
if (wp->flags & PANE_STYLECHANGED) {
log_debug("%%%u: style changed", wp->id); log_debug("%%%u: style changed", wp->id);
wp->flags &= ~PANE_STYLECHANGED; wp->flags &= ~PANE_STYLECHANGED;
ft = format_create(NULL, NULL, FORMAT_PANE|wp->id, ft = format_create(NULL, NULL, FORMAT_PANE|wp->id, FORMAT_NOJOBS);
FORMAT_NOJOBS);
format_defaults(ft, NULL, NULL, NULL, wp); format_defaults(ft, NULL, NULL, NULL, wp);
/* Window-level baseline. */
tty_window_default_style(&wp->cached_active_gc, wp); tty_window_default_style(&wp->cached_active_gc, wp);
style_add(&wp->cached_active_gc, wo, "window-active-style", ft); style_add(&wp->cached_active_gc, oo, "window-active-style", ft);
/* Floating pane window default overrides window baseline. */
if (wp->flags & PANE_FLOATING) if (wp->flags & PANE_FLOATING)
style_add(&wp->cached_active_gc, wo, style_add(&wp->cached_active_gc, oo, "floating-pane-style", ft);
"floating-pane-style", ft);
/* Per-pane override (set via new-pane -s or select-pane -P). */
if (options_get_only(wp->options, "window-active-style") != NULL)
style_add(&wp->cached_active_gc, wp->options,
"window-active-style", ft);
/* Window-level baseline. */
tty_window_default_style(&wp->cached_gc, wp); tty_window_default_style(&wp->cached_gc, wp);
style_add(&wp->cached_gc, wo, "window-style", ft); style_add(&wp->cached_gc, oo, "window-style", ft);
/* Floating pane window default overrides window baseline. */
if (wp->flags & PANE_FLOATING) if (wp->flags & PANE_FLOATING)
style_add(&wp->cached_gc, wo, "floating-pane-style", ft); style_add(&wp->cached_active_gc, oo, "floating-pane-style", ft);
/* Per-pane override (set via new-pane -s or select-pane -P). */
if (options_get_only(wp->options, "window-style") != NULL)
style_add(&wp->cached_gc, wp->options,
"window-style", ft);
format_free(ft); format_free(ft);
} }
if (gc->fg == 8) { 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 == wp->window->active && wp->cached_active_gc.fg != 8) if (wp == wp->window->active && wp->cached_active_gc.fg != 8)
gc->fg = wp->cached_active_gc.fg; gc->fg = wp->cached_active_gc.fg;
else else
gc->fg = wp->cached_gc.fg; gc->fg = wp->cached_gc.fg;
}
if (gc->bg == 8) {
if (wp == wp->window->active && wp->cached_active_gc.bg != 8) if (wp == wp->window->active && wp->cached_active_gc.bg != 8)
gc->bg = wp->cached_active_gc.bg; gc->bg = wp->cached_active_gc.bg;
else else
gc->bg = wp->cached_gc.bg; gc->bg = wp->cached_gc.bg;
}
} }
void void