Remove some non-FP code and remove explicit inheritance of pane options.

This commit is contained in:
Nicholas Marriott
2026-05-27 19:51:48 +01:00
parent 2d191970de
commit 73212da993
4 changed files with 34 additions and 127 deletions

View File

@@ -603,9 +603,7 @@ 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 (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);
@@ -872,7 +870,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;
@@ -891,11 +888,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;
} }

View File

@@ -1500,9 +1500,8 @@ server_client_loop(void)
{ {
struct client *c; struct client *c;
struct window *w; struct window *w;
struct window_pane *wp, *twp; struct window_pane *wp;
struct window_mode_entry *wme; struct window_mode_entry *wme;
u_int bit;
/* Check for window resize. This is done before redrawing. */ /* Check for window resize. This is done before redrawing. */
RB_FOREACH(w, windows, &windows) RB_FOREACH(w, windows, &windows)
@@ -1540,42 +1539,6 @@ server_client_loop(void)
server_client_check_pane_resize(wp); server_client_check_pane_resize(wp);
server_client_check_pane_buffer(wp); server_client_check_pane_buffer(wp);
} }
/*
* If PANE_REDRAW was set during buffer processing
* above, check_redraw has already run for this
* iteration and will not see it. Defer the redraw
* to the next iteration via CLIENT_REDRAWPANES so
* screen_redraw_pane fires once the grid is complete
* (e.g. after the shell prompt has been written).
*/
if (wp->flags & PANE_REDRAW) {
bit = 0;
TAILQ_FOREACH(twp, &w->panes, entry) {
if (twp == wp) {
TAILQ_FOREACH(c, &clients,
entry) {
if (c->session == NULL ||
c->session->curw ==
NULL ||
c->session->curw->window
!= w)
continue;
if (bit < 64) {
c->redraw_panes
|= (1ULL
<< bit);
c->flags |=
CLIENT_REDRAWPANES;
} else
c->flags |=
CLIENT_REDRAWWINDOW;
}
break;
}
if (++bit == 64)
break;
}
}
wp->flags &= ~(PANE_REDRAW|PANE_REDRAWSCROLLBAR); wp->flags &= ~(PANE_REDRAW|PANE_REDRAWSCROLLBAR);
} }
check_window_name(w); check_window_name(w);

36
tmux.1
View File

@@ -5201,42 +5201,6 @@ Set clock hour format.
.It Ic fill\-character Ar character .It Ic fill\-character Ar character
Set the character used to fill areas of the terminal unused by a window. Set the character used to fill areas of the terminal unused by a window.
.Pp .Pp
.It Ic floating\-pane\-border\-style Ar style
Set the default border style for all floating panes in the window.
This overrides
.Ic pane-border-style
for floating panes.
A per-pane style set with
.Fl S
on the
.Ic new\-pane
command or with
.Ic set-option Fl p
takes priority over this option.
For how to specify
.Ar style ,
see the
.Sx STYLES
section.
.Pp
.It Ic floating\-pane\-style Ar style
Set the default content style for all floating panes in the window.
This overrides
.Ic window-style
for floating panes.
A per-pane style set with
.Fl s
on the
.Ic new\-pane
command or with
.Ic select-pane Fl P
takes priority over this option.
For how to specify
.Ar style ,
see the
.Sx STYLES
section.
.Pp
.It Ic main\-pane\-height Ar height .It Ic main\-pane\-height Ar height
.It Ic main\-pane\-width Ar width .It Ic main\-pane\-width Ar width
Set the width or height of the main (left or top) pane in the Set the width or height of the main (left or top) pane in the

39
tty.c
View File

@@ -3060,56 +3060,43 @@ 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);
/* 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);
/* 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
tty_default_attributes(struct tty *tty, const struct grid_cell *defaults, tty_default_attributes(struct tty *tty, const struct grid_cell *defaults,