Add "box" option to pane-border-indicators#4940
Add "box" option to pane-border-indicators#4940patrick-motard wants to merge 9 commits intotmux:masterfrom
Conversation
Add infrastructure for a new "box" pane border indicator mode: - Add PANE_BORDER_BOX constant (value 4) to tmux.h - Add window_pane_box_mode() function to detect when box mode is active - Box mode requires: pane-border-indicators set to "box", more than one pane in the window, and pane size at least 3x3 The detection function will be used by subsequent commits to adjust screen sizing, content positioning, and border drawing.
When box mode is active, reduce both the screen buffer and PTY size by 2 in each dimension to reserve space for the border: - window_pane_resize(): Reduce screen buffer to (sx-2, sy-2) - window_pane_send_resize(): Report PTY size as (sx-2, sy-2) - options_push_changes(): Resize screen/PTY when option changes This ensures the shell receives the correct terminal dimensions and content cannot be written in the border area.
Adjust content and cursor positioning when box mode is active: - screen_write_set_client_cb(): Apply +1 offset to xoff/yoff for content positioning inside the border - server_client_reset_state(): Account for box mode offset when calculating cursor position - tty_window_offset1(): Account for box mode offset in view offset calculation This ensures content is rendered inside the border area and the cursor appears at the correct position.
Add screen_redraw_draw_active_box() to draw a complete box border around the active pane when box mode is enabled: - Draw styled border (using pane-active-border-style) for active pane - Draw blank spaces for inactive pane border areas - Skip normal pane separator borders when box mode is active - Adjust pane content drawing to account for box mode offset - Call box drawing on border redraws, window redraws, and pane redraws The box border uses the configured pane-border-lines style for the line drawing characters.
Add "box" as a valid choice for the pane-border-indicators window option. Update the option description to mention the new box mode.
Update tmux.1 man page to document the new "box" value for pane-border-indicators, explaining that it draws a complete box around the active pane and that content is inset to prevent reflow.
When box mode is active, the separator columns and rows between panes were not being cleared, causing old border characters to persist. Each pane's box is drawn within its allocated space, but the layout system places separator cells between panes that were left untouched. Add code to clear: - The separator column immediately to the right of each pane - The separator row immediately below each pane - The corner cell where separators intersect
Add MouseDown1Border key binding so clicking on any pane border selects that pane. Extend window_get_active_at() to include box border areas and adjacent separator cells in hit detection, which allows drag-to-resize to work correctly in box mode. Add box border edge detection as a fallback in server_client_check_mouse_in_pane() after traditional separator detection.
Fix border rendering when windows are larger than the terminal by adding viewport offset calculations (ctx->ox/oy) to all coordinate computations in screen_redraw_draw_active_box(). Borders are now clipped to the visible viewport and only drawn when within bounds. Add "box-all" option to pane-border-indicators that draws visible borders around all panes, not just the active one. Active pane uses pane-active-border-style, inactive panes use pane-border-style. Update man page and add basic regression test for option parsing.
64bd580 to
ed89b69
Compare
|
Still seeing a few unwanted artifacts when panes are larger than the viewport. Working on fixing those. |
|
I was literally just talking to a friend about how much we've wanted a more containerized approach to managing panes. This is exactly it. Really hoping they merge this |
|
Hey @patrick-motard, great work on this PR! I've been testing it on Arch Linux with Hyprland + Ghostty and the box borders look amazing. I found a content clipping bug and have a fix for it: Bug: In Visible symptom: Content in panes gets cut off at the left edge and bottom — the box border overlaps the leftmost column of text. Fix (in // Before:
tty_draw_line(tty, s, rr->px - wp->xoff, j,
rr->nx, rr->px, y, &defaults, palette);
// After:
u_int src_x;
src_x = rr->px - wp->xoff;
if (box_mode)
src_x -= 1;
tty_draw_line(tty, s, src_x, j,
rr->nx, rr->px, y, &defaults, palette);Tested with |

Reopening #4747 with additional fixes since the original PR.
Add a new "box" option for
pane-border-indicatorsthat draws a complete box border around the active pane instead of using shared separator borders between panes. Also adds "box-all" to draw borders around every pane.Screen.Recording.2026-03-18.at.10.59.36.PM.mov
Changes
PANE_BORDER_BOX/PANE_BORDER_BOX_ALLconstants andwindow_pane_box_mode()helperTest plan
box-all: borders on all panesoff/box/box-alldynamically