1
0
mirror of https://github.com/openbsd/src.git synced 2026-06-17 23:03:29 +02:00

Add -B to new-pane to select the floating pane border.

This commit is contained in:
nicm
2026-06-15 09:21:40 +00:00
parent 320aa6b0a9
commit c8249f6768
6 changed files with 50 additions and 12 deletions
+21 -5
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: cmd-split-window.c,v 1.133 2026/06/13 18:30:16 nicm Exp $ */
/* $OpenBSD: cmd-split-window.c,v 1.134 2026/06/15 09:21:40 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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')) {
+2 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: options-table.c,v 1.216 2026/06/15 08:16:05 nicm Exp $ */
/* $OpenBSD: options-table.c,v 1.217 2026/06/15 09:21:40 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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 "
+7 -2
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: screen-redraw.c,v 1.136 2026/06/15 08:16:05 nicm Exp $ */
/* $OpenBSD: screen-redraw.c,v 1.137 2026/06/15 09:21:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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) &&
+5 -1
View File
@@ -1,4 +1,4 @@
.\" $OpenBSD: tmux.1,v 1.1089 2026/06/15 08:16:05 nicm Exp $
.\" $OpenBSD: tmux.1,v 1.1090 2026/06/15 09:21:40 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -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
+2 -1
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1351 2026/06/15 08:16:05 nicm Exp $ */
/* $OpenBSD: tmux.h,v 1.1352 2026/06/15 09:21:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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,
+13 -1
View File
@@ -1,4 +1,4 @@
/* $OpenBSD: window.c,v 1.337 2026/06/15 08:16:05 nicm Exp $ */
/* $OpenBSD: window.c,v 1.338 2026/06/15 09:21:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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)
{