Add "box" option to pane-border-indicators#4747
Add "box" option to pane-border-indicators#4747patrick-motard wants to merge 7 commits intotmux:mastertmux/tmux:masterfrom patrick-motard:feature/pane-box-borderspatrick-motard/tmux:feature/pane-box-bordersCopy head branch name to clipboard
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
|
Thanks. This looks quite nice and the code looks OK, some comments on behaviour:
|
|
Thank you for the feedback @nicm. Iterating and will get back to you. |
|
Mouse re-sizing is working. Will push soon. Screen.Recording.2026-01-06.at.9.10.17.PM.mov |
|
@patrick-motard Oh and another by the way, please, @admins: the auto-closing and locking of issues and PRs is driving digital hygiene a bit over the top imho; preventing any further discussion on a topic is really not the most useful thing to do as a default, is it 🤣 |
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.PANE_BORDER_BOXconstant andwindow_pane_box_mode()helper functionHey @nicm - There's still a bit of polish I want to add before submitting it for a full review, but I wanted to share this draft with you on the off chance that you may be interested in a fully implemented version of this being added to
tmux/tmux.I have a heck of a time determining which pane is in focus when there are multiple panes in a window. The default boarder behavior trips me up. Updating my config to make the unfocused panes to be dimmed helped, but whenever panes have neovim open in them those panes aren't dimmed which leads to me still being unsure which pane is focused. So I decided to take a crack at adding support for adding a frame around all sides of the focused panel.
Here's a screencast showing the current behavior of this PR.
output.mp4