Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam
2026-06-15 09:30:05 +01:00
7 changed files with 65 additions and 32 deletions

View File

@@ -1157,15 +1157,13 @@ static void *
format_cb_pane_at_top(struct format_tree *ft) format_cb_pane_at_top(struct format_tree *ft)
{ {
struct window_pane *wp = ft->wp; struct window_pane *wp = ft->wp;
struct window *w;
int status, flag; int status, flag;
char *value; char *value;
if (wp == NULL) if (wp == NULL)
return (NULL); return (NULL);
w = wp->window;
status = window_get_pane_status(w); status = window_pane_get_pane_status(wp);
if (status == PANE_STATUS_TOP) if (status == PANE_STATUS_TOP)
flag = (wp->yoff == 1); flag = (wp->yoff == 1);
else else
@@ -1187,7 +1185,7 @@ format_cb_pane_at_bottom(struct format_tree *ft)
return (NULL); return (NULL);
w = wp->window; w = wp->window;
status = options_get_number(w->options, "pane-border-status"); status = window_pane_get_pane_status(wp);
if (status == PANE_STATUS_BOTTOM) if (status == PANE_STATUS_BOTTOM)
flag = (wp->yoff + (int)wp->sy == (int)w->sy - 1); flag = (wp->yoff + (int)wp->sy == (int)w->sy - 1);
else else

View File

@@ -70,7 +70,7 @@ static const char *options_table_pane_scrollbars_position_list[] = {
"right", "left", NULL "right", "left", NULL
}; };
static const char *options_table_pane_status_list[] = { 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[] = { static const char *options_table_pane_border_indicators_list[] = {
"off", "colour", "arrows", "both", NULL "off", "colour", "arrows", "both", NULL
@@ -1373,7 +1373,7 @@ const struct options_table_entry options_table[] = {
{ .name = "pane-border-status", { .name = "pane-border-status",
.type = OPTIONS_TABLE_CHOICE, .type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_WINDOW, .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
.choices = options_table_pane_status_list, .choices = options_table_pane_status_list,
.default_num = PANE_STATUS_OFF, .default_num = PANE_STATUS_OFF,
.text = "Position of the pane status lines." .text = "Position of the pane status lines."

View File

@@ -125,7 +125,8 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
{ {
struct options *oo = wp->window->options; struct options *oo = wp->window->options;
int ex = wp->xoff + wp->sx, ey = wp->yoff + wp->sy; 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 pane_scrollbars = ctx->pane_scrollbars, sb_w = 0;
int sb_pos, sx = wp->sx, sy = wp->sy; int sb_pos, sx = wp->sx, sy = wp->sy;
enum layout_type split_type; 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? */ /* 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--; sy--;
if (px > sx || py > sy) if (px > sx || py > sy)
return (0); return (0);
@@ -327,7 +328,8 @@ screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx,
{ {
struct client *c = ctx->c; struct client *c = ctx->c;
struct window *w = c->session->curw->window; 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; int sx = w->sx, sy = w->sy;
/* Is this outside the window? */ /* 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 *w = c->session->curw->window;
struct window_pane *wp, *start; struct window_pane *wp, *start;
int sx = w->sx, sy = w->sy; int sx = w->sx, sy = w->sy;
int pane_status = ctx->pane_status; int pane_status;
int border, pane_scrollbars = ctx->pane_scrollbars; int border, pane_scrollbars = ctx->pane_scrollbars;
int pane_status_line, tiled_only = 0, left, right; int pane_status_line, tiled_only = 0, left, right;
int sb_pos = ctx->pane_scrollbars_pos, sb_w; 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 * Pane border status inside top/bottom border is CELL_INSIDE
* so it doesn't get overdrawn by a border line. * 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_OFF) {
if (pane_status == PANE_STATUS_TOP) if (pane_status == PANE_STATUS_TOP)
pane_status_line = wp->yoff - 1; 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 format_tree *ft;
struct style_line_entry *sle = &wp->border_status_line; struct style_line_entry *sle = &wp->border_status_line;
char *expanded; 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 pane_scrollbars = rctx->pane_scrollbars;
int max_width; int max_width;
u_int width, i, cell_type, px, py; u_int width, i, cell_type, px, py;
struct screen_write_ctx ctx; struct screen_write_ctx ctx;
struct screen old; struct screen old;
if (pane_status == PANE_STATUS_OFF) {
wp->status_size = 0;
return (0);
}
if (window_pane_show_scrollbar(wp, pane_scrollbars)) if (window_pane_show_scrollbar(wp, pane_scrollbars))
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad; 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_ranges *r;
struct visible_range *ri; struct visible_range *ri;
u_int i, l, x, width, size; 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); 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; s = &wp->status_screen;
size = wp->status_size; 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; yoff = wp->yoff - 1;
else else
yoff = wp->yoff + wp->sy; 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) if (c->overlay_draw != NULL)
flags |= CLIENT_REDRAWOVERLAY; flags |= CLIENT_REDRAWOVERLAY;
if (ctx->pane_status != PANE_STATUS_OFF) { lines = ctx->pane_lines;
lines = ctx->pane_lines; redraw = 0;
redraw = 0; TAILQ_FOREACH(wp, &w->panes, entry) {
TAILQ_FOREACH(wp, &w->panes, entry) { if (screen_redraw_make_pane_status(c, wp, ctx, lines))
if (screen_redraw_make_pane_status(c, wp, ctx, lines)) redraw = 1;
redraw = 1;
}
if (redraw)
flags |= CLIENT_REDRAWBORDERS;
} }
if (redraw)
flags |= CLIENT_REDRAWBORDERS;
return (flags); return (flags);
} }
@@ -787,7 +797,6 @@ screen_redraw_set_context(struct client *c, struct screen_redraw_ctx *ctx)
ctx->statustop = 1; ctx->statustop = 1;
ctx->statuslines = lines; ctx->statuslines = lines;
ctx->pane_status = window_get_pane_status(w);
ctx->pane_lines = options_get_number(w->options, "pane-border-lines"); ctx->pane_lines = options_get_number(w->options, "pane-border-lines");
ctx->pane_scrollbars = options_get_number(w->options, ctx->pane_scrollbars = options_get_number(w->options,
@@ -824,8 +833,7 @@ screen_redraw_screen(struct client *c)
if (flags & (CLIENT_REDRAWWINDOW|CLIENT_REDRAWBORDERS)) { if (flags & (CLIENT_REDRAWWINDOW|CLIENT_REDRAWBORDERS)) {
log_debug("%s: redrawing borders", c->name); log_debug("%s: redrawing borders", c->name);
screen_redraw_draw_borders(&ctx); 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); screen_redraw_draw_pane_scrollbars(&ctx);
} }
if (flags & CLIENT_REDRAWWINDOW) { if (flags & CLIENT_REDRAWWINDOW) {

View File

@@ -610,7 +610,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
sb = options_get_number(w->options, "pane-scrollbars"); sb = options_get_number(w->options, "pane-scrollbars");
sb_pos = options_get_number(w->options, "pane-scrollbars-position"); 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)) { if (window_pane_show_scrollbar(wp, sb)) {
sb_w = wp->scrollbar_style.width; sb_w = wp->scrollbar_style.width;

7
tmux.1
View File

@@ -5640,9 +5640,14 @@ and
will fall back to standard ACS line drawing when UTF\-8 is not supported. will fall back to standard ACS line drawing when UTF\-8 is not supported.
.Pp .Pp
.It Xo Ic pane\-border\-status .It Xo Ic pane\-border\-status
.Op Ic off | top | bottom .Op Ic off | top | bottom | top\-floating | bottom\-floating
.Xc .Xc
Turn pane border status lines off or set their position. 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 .Pp
.It Ic pane\-border\-style Ar style .It Ic pane\-border\-style Ar style
Set the pane border style for panes aside from the active pane. Set the pane border style for panes aside from the active pane.

4
tmux.h
View File

@@ -1112,7 +1112,6 @@ struct screen_redraw_ctx {
u_int statuslines; u_int statuslines;
int statustop; int statustop;
int pane_status;
enum pane_lines pane_lines; enum pane_lines pane_lines;
int pane_scrollbars; int pane_scrollbars;
@@ -1450,6 +1449,8 @@ TAILQ_HEAD(winlink_stack, winlink);
#define PANE_STATUS_OFF 0 #define PANE_STATUS_OFF 0
#define PANE_STATUS_TOP 1 #define PANE_STATUS_TOP 1
#define PANE_STATUS_BOTTOM 2 #define PANE_STATUS_BOTTOM 2
#define PANE_STATUS_TOP_FLOATING 3
#define PANE_STATUS_BOTTOM_FLOATING 4
/* Pane scrollbars option. */ /* Pane scrollbars option. */
#define PANE_SCROLLBARS_OFF 0 #define PANE_SCROLLBARS_OFF 0
@@ -3523,6 +3524,7 @@ int window_get_bg_client(struct window_pane *);
enum client_theme window_pane_get_theme(struct window_pane *); enum client_theme window_pane_get_theme(struct window_pane *);
void window_pane_send_theme_update(struct window_pane *); void window_pane_send_theme_update(struct window_pane *);
int window_get_pane_status(struct window *); 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, struct style_range *window_pane_status_get_range(struct window_pane *, u_int,
u_int); u_int);
int window_pane_is_floating(struct window_pane *); int window_pane_is_floating(struct window_pane *);

View File

@@ -2137,16 +2137,14 @@ struct style_range *
window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y) window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y)
{ {
struct style_ranges *srs; struct style_ranges *srs;
struct window *w;
u_int line; u_int line;
int pane_status; int pane_status;
if (wp == NULL) if (wp == NULL)
return (NULL); return (NULL);
w = wp->window;
srs = &wp->border_status_line.ranges; 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) if (pane_status == PANE_STATUS_TOP)
line = wp->yoff - 1; line = wp->yoff - 1;
else if (pane_status == PANE_STATUS_BOTTOM) else if (pane_status == PANE_STATUS_BOTTOM)
@@ -2164,7 +2162,29 @@ window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y)
int int
window_get_pane_status(struct window *w) 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 int