1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-18 15:23:33 +02:00

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 15e936debb
commit fe658f293a
4 changed files with 73 additions and 47 deletions
+18 -3
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: options-table.c,v 1.211 2026/05/19 13:12:45 nicm Exp $ */
/* $OpenBSD: options-table.c,v 1.212 2026/05/27 18:57:10 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -189,7 +189,7 @@ static const char *options_table_copy_mode_line_numbers_list[] = {
"#{E:pane-status-style}" \
"]" \
"#[push-default]" \
"#P[#{pane_width}x#{pane_height}]" \
"#{T:window-pane-status-format}" \
"#[pop-default]" \
"#[norange list=on default] " \
"," \
@@ -200,7 +200,7 @@ static const char *options_table_copy_mode_line_numbers_list[] = {
"}" \
"]" \
"#[push-default]" \
"#P[#{pane_width}x#{pane_height}]*" \
"#{T:window-pane-current-status-format}" \
"#[pop-default]" \
"#[norange list=on default] " \
"}"
@@ -1519,6 +1519,21 @@ const struct options_table_entry options_table[] = {
.text = "Default style of the active pane."
},
{ .name = "window-pane-current-status-format",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "#P:[#T]#{?pane_flags,#{pane_flags}, }",
.text = "Format of the current window pane in the status line."
},
{ .name = "window-pane-status-format",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "#P:[#T]#{?pane_flags,#{pane_flags}, }",
.text = "Format of window panes in the status line, except the "
"current pane."
},
{ .name = "window-size",
.type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_WINDOW,
+7 -11
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: screen-redraw.c,v 1.123 2026/05/27 13:41:20 nicm Exp $ */
/* $OpenBSD: screen-redraw.c,v 1.124 2026/05/27 18:57:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -603,9 +603,7 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp,
border_option = "pane-active-border-style";
else
border_option = "pane-border-style";
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);
style_apply(&gc, wp->options, border_option, ft);
fmt = options_get_string(wp->options, "pane-border-format");
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 session *s = c->session;
struct window *w = s->curw->window;
struct window_pane *active = server_client_get_pane(c);
struct grid_cell *gc;
const char *border_option;
@@ -891,11 +888,7 @@ screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x,
if (!*flag) {
ft = format_create_defaults(NULL, c, s, s->curw, wp);
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);
style_apply(gc, wp->options, border_option, ft);
format_free(ft);
*flag = 1;
}
@@ -1152,6 +1145,10 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
return (&sr);
}
w = base_wp->window;
if (px + width > w->sx)
width = w->sx - px;
if (r == NULL) {
/* Start with the entire width of the range. */
server_client_ensure_ranges(&base_wp->r, 1);
@@ -1161,7 +1158,6 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, u_int px,
r->used = 1;
}
w = base_wp->window;
sb = options_get_number(w->options, "pane-scrollbars");
sb_pos = options_get_number(w->options, "pane-scrollbars-position");
+16 -2
View File
@@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.1057 2026/05/25 14:53:09 nicm Exp $
.\" $OpenBSD: tmux.1,v 1.1058 2026/05/27 18:57:10 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: May 25 2026 $
.Dd $Mdocdate: May 27 2026 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -5765,6 +5765,20 @@ For how to specify
see the
.Sx STYLES
section.
.Pp
.It Ic window-pane-status-format Ar string
Set the format in which the window pane is displayed in the status line window
pane list.
See the
.Sx FORMATS
and
.Sx STYLES
sections.
.Pp
.It Ic window-pane-current-status-format Ar string
Like
.Ar window-status-format ,
but is the format used when the window is the current window.
.El
.Sh HOOKS
.Nm
+32 -31
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: tty.c,v 1.463 2026/05/27 11:54:28 nicm Exp $ */
/* $OpenBSD: tty.c,v 1.464 2026/05/27 18:57:10 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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