From a41e6e2ed23f386da5630e6db379fadb477442c3 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 15 Jun 2026 09:21:40 +0000 Subject: [PATCH] Add -B to new-pane to select the floating pane border. --- cmd-split-window.c | 24 ++++++++++++++++++++---- options-table.c | 2 +- screen-redraw.c | 7 ++++++- tmux.1 | 4 ++++ tmux.h | 1 + window.c | 12 ++++++++++++ 6 files changed, 44 insertions(+), 6 deletions(-) diff --git a/cmd-split-window.c b/cmd-split-window.c index 1c9eaae9..ee3eeb4c 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -39,9 +39,10 @@ const struct cmd_entry cmd_new_pane_entry = { .name = "new-pane", .alias = "newp", - .args = { "bc:de:EfF:hIkl:Lm:p:PR:s:S:t:T:vWx:X:y:Y:Z", 0, -1, NULL }, - .usage = "[-bdefhIklPvWZ] [-c start-directory] [-e environment] " - "[-F format] [-l size] [-m message] [-p percentage] " + .args = { "bB:c:de:EfF:hIkl:Lm:p:PR:s:S:t:T:vWx:X:y:Y:Z", 0, -1, NULL }, + .usage = "[-bdefhIklPvWZ] [-B border-lines] " + "[-c start-directory] [-e environment] " + "[-F format] [-l size] [-m message] [-p percentage] " "[-s style] [-S active-border-style] " "[-R inactive-border-style] [-T title] [-x width] [-y height] " "[-X x-position] [-Y y-position] " CMD_TARGET_PANE_USAGE " " @@ -85,9 +86,11 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) struct layout_cell *lc = NULL; struct cmd_find_state fs; int input, empty, is_floating, flags = 0; - const char *template, *style; + const char *template, *style, *value; char *cause = NULL, *cp, *title; + struct options_entry *oe; struct args_value *av; + enum pane_lines lines; u_int count = args_count(args); if (cmd_get_entry(self) == &cmd_new_pane_entry) @@ -188,6 +191,19 @@ cmd_split_window_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_ERROR); } } + value = args_get(args, 'B'); + if (value != NULL) { + oe = options_get(new_wp->options, "pane-border-lines"); + lines = options_find_choice(options_table_entry(oe), value, + &cause); + if (cause != NULL) { + cmdq_error(item, "pane-border-lines %s", cause); + free(cause); + return (CMD_RETURN_ERROR); + } + options_set_number(new_wp->options, "pane-border-lines", + lines); + } if (args_has(args, 'k') || args_has(args, 'm')) { options_set_number(new_wp->options, "remain-on-exit", 3); if (args_has(args, 'm')) { diff --git a/options-table.c b/options-table.c index d24b90b3..92b0519b 100644 --- a/options-table.c +++ b/options-table.c @@ -1365,7 +1365,7 @@ const struct options_table_entry options_table[] = { { .name = "pane-border-lines", .type = OPTIONS_TABLE_CHOICE, - .scope = OPTIONS_TABLE_WINDOW, + .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, .choices = options_table_pane_border_lines_list, .default_num = PANE_LINES_SINGLE, .text = "Type of characters used to draw pane border lines. Some of " diff --git a/screen-redraw.c b/screen-redraw.c index 3f04e74c..ce98dd99 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1003,6 +1003,7 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j) struct format_tree *ft; struct window_pane *wp, *active = server_client_get_pane(c); struct grid_cell gc; + enum pane_lines pane_lines; u_int cell_type; u_int x = ctx->ox + i, y = ctx->oy + j; int isolates; @@ -1034,7 +1035,11 @@ screen_redraw_draw_borders_cell(struct screen_redraw_ctx *ctx, u_int i, u_int j) screen_redraw_check_is(ctx, x, y, marked_pane.wp)) gc.attr ^= GRID_ATTR_REVERSE; } - screen_redraw_border_set(w, wp, ctx->pane_lines, cell_type, &gc); + if (wp == NULL) + pane_lines = ctx->pane_lines; + else + pane_lines = window_pane_get_pane_lines(wp); + screen_redraw_border_set(w, wp, pane_lines, cell_type, &gc); if (cell_type == CELL_TOPBOTTOM && (c->flags & CLIENT_UTF8) && diff --git a/tmux.1 b/tmux.1 index 40f74d95..59ed8c75 100644 --- a/tmux.1 +++ b/tmux.1 @@ -3490,6 +3490,7 @@ but a different format may be specified with .Tg newp .It Xo Ic new\-pane .Op Fl bdefhIkPvWZ +.Op Fl B Ar border\-lines .Op Fl c Ar start\-directory .Op Fl e Ar environment .Op Fl F Ar format @@ -3521,6 +3522,9 @@ sets the border style when the pane is inactive (see .Sx STYLES ) . .Fl T sets the pane title. +.Fl B +sets the pane border lines for floating panes; see +.Ic pane\-border\-lines . .Pp .Fl h does a horizontal split and diff --git a/tmux.h b/tmux.h index 11590bc1..b70fdf06 100644 --- a/tmux.h +++ b/tmux.h @@ -3474,6 +3474,7 @@ int window_pane_get_bg_control_client(struct window_pane *); 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 *); +enum pane_lines window_pane_get_pane_lines(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, diff --git a/window.c b/window.c index 4ab5ca32..b3a0a0ea 100644 --- a/window.c +++ b/window.c @@ -2148,6 +2148,18 @@ window_pane_status_get_range(struct window_pane *wp, u_int x, u_int y) return (style_ranges_get_range(srs, x - wp->xoff - 2)); } +enum pane_lines +window_pane_get_pane_lines(struct window_pane *wp) +{ + struct options *oo; + + if (!window_pane_is_floating(wp)) + oo = wp->window->options; + else + oo = wp->options; + return (options_get_number(oo, "pane-border-lines")); +} + int window_get_pane_status(struct window *w) {