Add pane-border-lines none like popups (-B to new-pane).

This commit is contained in:
nicm
2026-06-15 17:34:25 +00:00
parent bb750b07bc
commit b86bd1fcd0
8 changed files with 79 additions and 29 deletions

View File

@@ -71,20 +71,24 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl,
struct window_pane *owp; struct window_pane *owp;
int wx = w->sx, wy = w->sy, px = lc->sx; int wx = w->sx, wy = w->sy, px = lc->sx;
int py = lc->sy, xoff = lc->xoff, yoff = lc->yoff; int py = lc->sy, xoff = lc->xoff, yoff = lc->yoff;
int border = 1;
if (window_pane_get_pane_lines(wp) == PANE_LINES_NONE)
border = 0;
if (strcmp(position, "top-left") == 0) { if (strcmp(position, "top-left") == 0) {
xoff = 1; xoff = border;
yoff = 1; yoff = border;
} else if (strcmp(position, "top-centre") == 0 || } else if (strcmp(position, "top-centre") == 0 ||
strcmp(position, "top-center") == 0) { strcmp(position, "top-center") == 0) {
xoff = (wx - px) / 2; xoff = (wx - px) / 2;
yoff = 1; yoff = border;
} else if (strcmp(position, "top-right") == 0) { } else if (strcmp(position, "top-right") == 0) {
xoff = wx - px - 1; xoff = wx - px - border;
yoff = 1; yoff = border;
} else if (strcmp(position, "centre-left") == 0 || } else if (strcmp(position, "centre-left") == 0 ||
strcmp(position, "center-left") == 0) { strcmp(position, "center-left") == 0) {
xoff = 1; xoff = border;
yoff = (wy - py) / 2; yoff = (wy - py) / 2;
} else if (strcmp(position, "centre") == 0 || } else if (strcmp(position, "centre") == 0 ||
strcmp(position, "center") == 0) { strcmp(position, "center") == 0) {
@@ -92,18 +96,18 @@ cmd_join_pane_place(struct cmdq_item *item, struct winlink *wl,
yoff = (wy - py) / 2; yoff = (wy - py) / 2;
} else if (strcmp(position, "centre-right") == 0 || } else if (strcmp(position, "centre-right") == 0 ||
strcmp(position, "center-right") == 0) { strcmp(position, "center-right") == 0) {
xoff = wx - px - 1; xoff = wx - px - border;
yoff = (wy - py) / 2; yoff = (wy - py) / 2;
} else if (strcmp(position, "bottom-left") == 0) { } else if (strcmp(position, "bottom-left") == 0) {
xoff = 1; xoff = border;
yoff = wy - py - 1; yoff = wy - py - border;
} else if (strcmp(position, "bottom-centre") == 0 || } else if (strcmp(position, "bottom-centre") == 0 ||
strcmp(position, "bottom-center") == 0) { strcmp(position, "bottom-center") == 0) {
xoff = (wx - px) / 2; xoff = (wx - px) / 2;
yoff = wy - py - 1; yoff = wy - py - border;
} else if (strcmp(position, "bottom-right") == 0) { } else if (strcmp(position, "bottom-right") == 0) {
xoff = wx - px - 1; xoff = wx - px - border;
yoff = wy - py - 1; yoff = wy - py - border;
} else if (strcmp(position, "top-left-centre") == 0 || } else if (strcmp(position, "top-left-centre") == 0 ||
strcmp(position, "top-left-center") == 0) { strcmp(position, "top-left-center") == 0) {
xoff = wx / 4 - px / 2; xoff = wx / 4 - px / 2;

View File

@@ -712,7 +712,8 @@ layout_resize_floating_pane_to(struct window_pane *wp, enum layout_type type,
return; return;
} }
if (size >= PANE_MINIMUM + 2) if (window_pane_get_pane_lines(wp) != PANE_LINES_NONE &&
size >= PANE_MINIMUM + 2)
size -= 2; size -= 2;
if (size < PANE_MINIMUM || size > PANE_MAXIMUM) { if (size < PANE_MINIMUM || size > PANE_MAXIMUM) {
*cause = xstrdup("size is too big or too small"); *cause = xstrdup("size is too big or too small");

View File

@@ -77,7 +77,7 @@ static const char *options_table_pane_border_indicators_list[] = {
"off", "colour", "arrows", "both", NULL "off", "colour", "arrows", "both", NULL
}; };
static const char *options_table_pane_border_lines_list[] = { static const char *options_table_pane_border_lines_list[] = {
"single", "double", "heavy", "simple", "number", "spaces", NULL "single", "double", "heavy", "simple", "number", "spaces", "none", NULL
}; };
static const char *options_table_popup_border_lines_list[] = { static const char *options_table_popup_border_lines_list[] = {
"single", "double", "heavy", "simple", "rounded", "padded", "none", NULL "single", "double", "heavy", "simple", "rounded", "padded", "none", NULL

View File

@@ -87,6 +87,7 @@ screen_redraw_border_set(struct window *w, struct window_pane *wp,
gc->attr &= ~GRID_ATTR_CHARSET; gc->attr &= ~GRID_ATTR_CHARSET;
utf8_set(&gc->data, SIMPLE_BORDERS[cell_type]); utf8_set(&gc->data, SIMPLE_BORDERS[cell_type]);
break; break;
case PANE_LINES_NONE:
case PANE_LINES_SPACES: case PANE_LINES_SPACES:
gc->attr &= ~GRID_ATTR_CHARSET; gc->attr &= ~GRID_ATTR_CHARSET;
utf8_set(&gc->data, ' '); utf8_set(&gc->data, ' ');
@@ -140,6 +141,10 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
if (px >= wp->xoff && px < ex && py >= wp->yoff && py < ey) if (px >= wp->xoff && px < ex && py >= wp->yoff && py < ey)
return (SCREEN_REDRAW_INSIDE); return (SCREEN_REDRAW_INSIDE);
if (window_pane_is_floating(wp) &&
window_pane_get_pane_lines(wp) == PANE_LINES_NONE)
return (SCREEN_REDRAW_OUTSIDE);
/* Are scrollbars enabled? */ /* Are scrollbars enabled? */
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;
@@ -1153,7 +1158,7 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
struct window *w; struct window *w;
struct visible_range *ri; struct visible_range *ri;
static struct visible_ranges sr = { NULL, 0, 0 }; static struct visible_ranges sr = { NULL, 0, 0 };
int found_self, sb, sb_w, sb_pos; int found_self, sb, sb_w, sb_pos, no_border;
int lb, rb, tb, bb, sx, ex; int lb, rb, tb, bb, sx, ex;
u_int i, s; u_int i, s;
@@ -1203,8 +1208,18 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
continue; continue;
} }
tb = wp->yoff > 0 ? wp->yoff - 1 : 0; if (window_pane_is_floating(wp) &&
bb = wp->yoff + wp->sy; window_pane_get_pane_lines(wp) == PANE_LINES_NONE)
no_border = 1;
else
no_border = 0;
if (no_border) {
tb = wp->yoff;
bb = wp->yoff + (int)wp->sy - 1;
} else {
tb = wp->yoff > 0 ? wp->yoff - 1 : 0;
bb = wp->yoff + (int)wp->sy;
}
if (!found_self || if (!found_self ||
!window_pane_visible(wp) || !window_pane_visible(wp) ||
py < tb || py < tb ||
@@ -1219,7 +1234,10 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
for (i = 0; i < r->used; i++) { for (i = 0; i < r->used; i++) {
ri = &r->ranges[i]; ri = &r->ranges[i];
if (sb_pos == PANE_SCROLLBARS_LEFT) { if (no_border) {
lb = wp->xoff;
rb = wp->xoff + (int)wp->sx - 1;
} else if (sb_pos == PANE_SCROLLBARS_LEFT) {
if (wp->xoff > sb_w) if (wp->xoff > sb_w)
lb = wp->xoff - 1 - sb_w; lb = wp->xoff - 1 - sb_w;
else else
@@ -1230,11 +1248,19 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
else else
lb = 0; lb = 0;
} }
if (sb_pos == PANE_SCROLLBARS_LEFT) if (!no_border) {
rb = wp->xoff + wp->sx; if (sb_pos == PANE_SCROLLBARS_LEFT)
else /* PANE_SCROLLBARS_RIGHT or none. */ rb = wp->xoff + (int)wp->sx;
rb = wp->xoff + wp->sx + sb_w; else /* PANE_SCROLLBARS_RIGHT or none. */
if (rb > (int)w->sx) rb = wp->xoff + (int)wp->sx + sb_w;
}
if (lb < 0)
lb = 0;
if (rb < 0)
continue;
if (no_border && rb >= (int)w->sx)
rb = w->sx - 1;
else if (!no_border && rb > (int)w->sx)
rb = w->sx - 1; rb = w->sx - 1;
sx = ri->px; sx = ri->px;

View File

@@ -602,6 +602,7 @@ server_client_exec(struct client *c, const char *cmd)
free(msg); free(msg);
} }
/* Is the mouse inside a pane? */
static enum key_code_mouse_location static enum key_code_mouse_location
server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py, server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
u_int *sl_mpos) u_int *sl_mpos)
@@ -659,6 +660,7 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
} else /* py > sl_bottom */ } else /* py > sl_bottom */
return (KEYC_MOUSE_LOCATION_SCROLLBAR_DOWN); return (KEYC_MOUSE_LOCATION_SCROLLBAR_DOWN);
} else if (window_pane_is_floating(wp) && } else if (window_pane_is_floating(wp) &&
window_pane_get_pane_lines(wp) != PANE_LINES_NONE &&
(px == wp->xoff - 1 || (px == wp->xoff - 1 ||
py == wp->yoff - 1 || py == wp->yoff - 1 ||
py == wp->yoff + (int)wp->sy)) { py == wp->yoff + (int)wp->sy)) {
@@ -674,6 +676,9 @@ server_client_check_mouse_in_pane(struct window_pane *wp, int px, int py,
if ((w->flags & WINDOW_ZOOMED) && if ((w->flags & WINDOW_ZOOMED) &&
(~fwp->flags & PANE_ZOOMED)) (~fwp->flags & PANE_ZOOMED))
continue; continue;
if (window_pane_is_floating(fwp) &&
window_pane_get_pane_lines(fwp) == PANE_LINES_NONE)
continue;
bdr_top = fwp->yoff - 1; bdr_top = fwp->yoff - 1;
bdr_bottom = fwp->yoff + fwp->sy; bdr_bottom = fwp->yoff + fwp->sy;
if (sb_pos == PANE_SCROLLBARS_LEFT) if (sb_pos == PANE_SCROLLBARS_LEFT)
@@ -1510,12 +1515,14 @@ server_client_handle_key0(struct client *c, struct key_event *event,
return (1); return (1);
} }
/* Handle key and insert at end of queue. */
int int
server_client_handle_key(struct client *c, struct key_event *event) server_client_handle_key(struct client *c, struct key_event *event)
{ {
return (server_client_handle_key0(c, event, NULL, NULL)); return (server_client_handle_key0(c, event, NULL, NULL));
} }
/* Handle key and insert after another item. */
int int
server_client_handle_key_after(struct client *c, struct key_event *event, server_client_handle_key_after(struct client *c, struct key_event *event,
struct cmdq_item *after, struct cmdq_item **next) struct cmdq_item *after, struct cmdq_item **next)

2
tmux.1
View File

@@ -5634,6 +5634,8 @@ simple ASCII characters
the pane number the pane number
.It spaces .It spaces
space characters space characters
.It none
no border for floating panes
.El .El
.Pp .Pp
.Ql double .Ql double

3
tmux.h
View File

@@ -1057,7 +1057,8 @@ enum pane_lines {
PANE_LINES_HEAVY, PANE_LINES_HEAVY,
PANE_LINES_SIMPLE, PANE_LINES_SIMPLE,
PANE_LINES_NUMBER, PANE_LINES_NUMBER,
PANE_LINES_SPACES PANE_LINES_SPACES,
PANE_LINES_NONE
}; };
/* Pane border indicator option. */ /* Pane border indicator option. */

View File

@@ -667,11 +667,18 @@ window_get_active_at(struct window *w, u_int x, u_int y)
continue; continue;
} }
} else { } else {
/* Floating - include all borders. */ if (window_pane_get_pane_lines(wp) == PANE_LINES_NONE) {
if ((int)x < xoff - 1 || x > xoff + sx) if ((int)x < xoff || (int)x >= xoff + (int)sx)
continue; continue;
if ((int)y < yoff - 1 || y > yoff + sy) if ((int)y < yoff || (int)y >= yoff + (int)sy)
continue; continue;
} else {
/* Floating - include all borders. */
if ((int)x < xoff - 1 || x > xoff + sx)
continue;
if ((int)y < yoff - 1 || y > yoff + sy)
continue;
}
} }
return (wp); return (wp);
} }
@@ -2179,6 +2186,8 @@ window_pane_get_pane_status(struct window_pane *wp)
if (!window_pane_is_floating(wp)) if (!window_pane_is_floating(wp))
return (window_get_pane_status(wp->window)); return (window_get_pane_status(wp->window));
if (window_pane_get_pane_lines(wp) == PANE_LINES_NONE)
return (PANE_STATUS_OFF);
status = options_get_number(wp->options, "pane-border-status"); status = options_get_number(wp->options, "pane-border-status");
if (status == PANE_STATUS_TOP_FLOATING) if (status == PANE_STATUS_TOP_FLOATING)