diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c index 82cc3548f90..f928664b7fe 100644 --- a/usr.bin/tmux/format.c +++ b/usr.bin/tmux/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.378 2026/06/14 19:31:37 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.379 2026/06/15 08:16:05 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -1143,15 +1143,13 @@ static void * format_cb_pane_at_top(struct format_tree *ft) { struct window_pane *wp = ft->wp; - struct window *w; int status, flag; char *value; if (wp == NULL) return (NULL); - w = wp->window; - status = window_get_pane_status(w); + status = window_pane_get_pane_status(wp); if (status == PANE_STATUS_TOP) flag = (wp->yoff == 1); else @@ -1173,7 +1171,7 @@ format_cb_pane_at_bottom(struct format_tree *ft) return (NULL); w = wp->window; - status = options_get_number(w->options, "pane-border-status"); + status = window_pane_get_pane_status(wp); if (status == PANE_STATUS_BOTTOM) flag = (wp->yoff + (int)wp->sy == (int)w->sy - 1); else diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index bd4c60d5bca..a086ecab5a0 100644 --- a/usr.bin/tmux/options-table.c +++ b/usr.bin/tmux/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.215 2026/06/10 16:08:03 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.216 2026/06/15 08:16:05 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -71,7 +71,7 @@ static const char *options_table_pane_scrollbars_position_list[] = { "right", "left", NULL }; static const char *options_table_pane_status_list[] = { - "off", "top", "bottom", NULL + "off", "top", "bottom", "top-floating", "bottom-floating", NULL }; static const char *options_table_pane_border_indicators_list[] = { "off", "colour", "arrows", "both", NULL @@ -1374,7 +1374,7 @@ const struct options_table_entry options_table[] = { { .name = "pane-border-status", .type = OPTIONS_TABLE_CHOICE, - .scope = OPTIONS_TABLE_WINDOW, + .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, .choices = options_table_pane_status_list, .default_num = PANE_STATUS_OFF, .text = "Position of the pane status lines." diff --git a/usr.bin/tmux/screen-redraw.c b/usr.bin/tmux/screen-redraw.c index 67be367de91..ad82aa0ee96 100644 --- a/usr.bin/tmux/screen-redraw.c +++ b/usr.bin/tmux/screen-redraw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-redraw.c,v 1.135 2026/06/14 20:53:20 nicm Exp $ */ +/* $OpenBSD: screen-redraw.c,v 1.136 2026/06/15 08:16:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -125,7 +125,8 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, { struct options *oo = wp->window->options; int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy; - int hsplit = 0, vsplit = 0, pane_status = ctx->pane_status; + int hsplit = 0, vsplit = 0; + int pane_status = window_pane_get_pane_status(wp); int pane_scrollbars = ctx->pane_scrollbars, sb_w = 0; int sb_pos, sx = wp->sx, sy = wp->sy; enum layout_type split_type; @@ -296,7 +297,7 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp, } /* Outside the window or on the window border? */ - if (ctx->pane_status == PANE_STATUS_BOTTOM) + if (window_pane_get_pane_status(wp) == PANE_STATUS_BOTTOM) sy--; if (px > sx || py > sy) return (0); @@ -327,7 +328,8 @@ screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx, { struct client *c = ctx->c; struct window *w = c->session->curw->window; - int pane_status = ctx->pane_status, borders = 0; + int pane_status = window_pane_get_pane_status(wp); + int borders = 0; int sx = w->sx, sy = w->sy; /* Is this outside the window? */ @@ -435,7 +437,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py, struct window *w = c->session->curw->window; struct window_pane *wp, *start; int sx = w->sx, sy = w->sy; - int pane_status = ctx->pane_status; + int pane_status; int border, pane_scrollbars = ctx->pane_scrollbars; int pane_status_line, tiled_only = 0, left, right; int sb_pos = ctx->pane_scrollbars_pos, sb_w; @@ -511,6 +513,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py, * Pane border status inside top/bottom border is CELL_INSIDE * so it doesn't get overdrawn by a border line. */ + pane_status = window_pane_get_pane_status(wp); if (pane_status != PANE_STATUS_OFF) { if (pane_status == PANE_STATUS_TOP) pane_status_line = wp->yoff - 1; @@ -593,13 +596,19 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp, struct format_tree *ft; struct style_line_entry *sle = &wp->border_status_line; char *expanded; - int pane_status = rctx->pane_status, sb_w = 0; + int pane_status = window_pane_get_pane_status(wp); + int sb_w = 0; int pane_scrollbars = rctx->pane_scrollbars; int max_width; u_int width, i, cell_type, px, py; struct screen_write_ctx ctx; struct screen old; + if (pane_status == PANE_STATUS_OFF) { + wp->status_size = 0; + return (0); + } + if (window_pane_show_scrollbar(wp, pane_scrollbars)) sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad; @@ -673,7 +682,7 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx) struct visible_ranges *r; struct visible_range *ri; u_int i, l, x, width, size; - int xoff, yoff; + int xoff, yoff, pane_status; log_debug("%s: %s @%u", __func__, c->name, w->id); @@ -683,7 +692,10 @@ screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx) s = &wp->status_screen; size = wp->status_size; - if (ctx->pane_status == PANE_STATUS_TOP) + pane_status = window_pane_get_pane_status(wp); + if (pane_status == PANE_STATUS_OFF) + continue; + if (pane_status == PANE_STATUS_TOP) yoff = wp->yoff - 1; else yoff = wp->yoff + wp->sy; @@ -754,16 +766,14 @@ screen_redraw_update(struct screen_redraw_ctx *ctx, uint64_t flags) if (c->overlay_draw != NULL) flags |= CLIENT_REDRAWOVERLAY; - if (ctx->pane_status != PANE_STATUS_OFF) { - lines = ctx->pane_lines; - redraw = 0; - TAILQ_FOREACH(wp, &w->panes, entry) { - if (screen_redraw_make_pane_status(c, wp, ctx, lines)) - redraw = 1; - } - if (redraw) - flags |= CLIENT_REDRAWBORDERS; + lines = ctx->pane_lines; + redraw = 0; + TAILQ_FOREACH(wp, &w->panes, entry) { + if (screen_redraw_make_pane_status(c, wp, ctx, lines)) + redraw = 1; } + if (redraw) + flags |= CLIENT_REDRAWBORDERS; return (flags); } @@ -787,7 +797,6 @@ screen_redraw_set_context(struct client *c, struct screen_redraw_ctx *ctx) ctx->statustop = 1; ctx->statuslines = lines; - ctx->pane_status = window_get_pane_status(w); ctx->pane_lines = options_get_number(w->options, "pane-border-lines"); ctx->pane_scrollbars = options_get_number(w->options, @@ -824,8 +833,7 @@ screen_redraw_screen(struct client *c) if (flags & (CLIENT_REDRAWWINDOW|CLIENT_REDRAWBORDERS)) { log_debug("%s: redrawing borders", c->name); screen_redraw_draw_borders(&ctx); - if (ctx.pane_status != PANE_STATUS_OFF) - screen_redraw_draw_pane_status(&ctx); + screen_redraw_draw_pane_status(&ctx); screen_redraw_draw_pane_scrollbars(&ctx); } if (flags & CLIENT_REDRAWWINDOW) { diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index ffbed9fd8c5..da2ee9620bd 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.468 2026/06/14 19:31:37 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.469 2026/06/15 08:16:05 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -614,7 +614,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py, sb = options_get_number(w->options, "pane-scrollbars"); sb_pos = options_get_number(w->options, "pane-scrollbars-position"); - pane_status = window_get_pane_status(w); + pane_status = window_pane_get_pane_status(wp); if (window_pane_show_scrollbar(wp, sb)) { sb_w = wp->scrollbar_style.width; diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index f5906ef1526..8721efaeea8 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.1088 2026/06/13 20:39:11 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.1089 2026/06/15 08:16:05 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -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: June 13 2026 $ +.Dd $Mdocdate: June 15 2026 $ .Dt TMUX 1 .Os .Sh NAME @@ -5638,9 +5638,14 @@ and will fall back to standard ACS line drawing when UTF\-8 is not supported. .Pp .It Xo Ic pane\-border\-status -.Op Ic off | top | bottom +.Op Ic off | top | bottom | top\-floating | bottom\-floating .Xc Turn pane border status lines off or set their position. +If set to +.Ic top\-floating +or +.Ic bottom\-floating , +status lines are shown only on floating panes. .Pp .It Ic pane\-border\-style Ar style Set the pane border style for panes aside from the active pane. diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 8875d3564c0..0603876b788 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1350 2026/06/15 07:40:45 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1351 2026/06/15 08:16:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1078,7 +1078,6 @@ struct screen_redraw_ctx { u_int statuslines; int statustop; - int pane_status; enum pane_lines pane_lines; int pane_scrollbars; @@ -1416,6 +1415,8 @@ TAILQ_HEAD(winlink_stack, winlink); #define PANE_STATUS_OFF 0 #define PANE_STATUS_TOP 1 #define PANE_STATUS_BOTTOM 2 +#define PANE_STATUS_TOP_FLOATING 3 +#define PANE_STATUS_BOTTOM_FLOATING 4 /* Pane scrollbars option. */ #define PANE_SCROLLBARS_OFF 0 @@ -3474,6 +3475,7 @@ int window_get_bg_client(struct window_pane *); enum client_theme window_pane_get_theme(struct window_pane *); void window_pane_send_theme_update(struct window_pane *); int window_get_pane_status(struct window *); +int window_pane_get_pane_status(struct window_pane *); struct style_range *window_pane_status_get_range(struct window_pane *, u_int, u_int); int window_pane_is_floating(struct window_pane *); diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index b617d884a73..1c646c0a071 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.336 2026/06/14 19:31:37 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.337 2026/06/15 08:16:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2126,16 +2126,14 @@ struct style_range * window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y) { struct style_ranges *srs; - struct window *w; u_int line; int pane_status; if (wp == NULL) return (NULL); - w = wp->window; srs = &wp->border_status_line.ranges; - pane_status = window_get_pane_status(w); + pane_status = window_pane_get_pane_status(wp); if (pane_status == PANE_STATUS_TOP) line = wp->yoff - 1; else if (pane_status == PANE_STATUS_BOTTOM) @@ -2153,7 +2151,29 @@ window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y) int window_get_pane_status(struct window *w) { - return (options_get_number(w->options, "pane-border-status")); + int status; + + status = options_get_number(w->options, "pane-border-status"); + if (status == PANE_STATUS_TOP_FLOATING || + status == PANE_STATUS_BOTTOM_FLOATING) + return (PANE_STATUS_OFF); + return (status); +} + +int +window_pane_get_pane_status(struct window_pane *wp) +{ + int status; + + if (!window_pane_is_floating(wp)) + return (window_get_pane_status(wp->window)); + + status = options_get_number(wp->options, "pane-border-status"); + if (status == PANE_STATUS_TOP_FLOATING) + return (PANE_STATUS_TOP); + if (status == PANE_STATUS_BOTTOM_FLOATING) + return (PANE_STATUS_BOTTOM); + return (status); } int