Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add "box" option to pane-border-indicators#4747

Draft
patrick-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
Draft

Add "box" option to pane-border-indicators#4747
patrick-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

@patrick-motard
Copy link

@patrick-motard patrick-motard commented Dec 6, 2025

Add a new "box" option for pane-border-indicators that draws a complete box border around the active pane instead of using shared separator borders between panes.

  • Add PANE_BORDER_BOX constant and window_pane_box_mode() helper function
  • Reduce internal screen buffer and PTY by 2 in each dimension to reserve space for box borders
  • Offset pane content drawing by 1 to account for box border
  • Adjust cursor positioning for box mode offset
  • Draw styled box border for active pane, blank borders for inactive panes
  • Skip normal pane separator borders when box mode is active
  • Clear separator cells between panes that would otherwise show old borders

Hey @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

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
@nicm
Copy link
Member

nicm commented Dec 7, 2025

Thanks. This looks quite nice and the code looks OK, some comments on behaviour:

  • The mouse doesn't work on the borders, you have to drag where the split would have been which is invisible, this isn't very intuitive.

  • I find the way that the borders of all the inactive pane disappears completely and only the active pane has a border quite attractive, but others may disagree, and not having a way to have a box round inactive panes as well seems like it would be a missed opportunity (maybe box-all or something?).

  • If the boxes round inactive panes are invisible, there is no need to reserve space for them - you could put the bottom line of the top pane's box on the same line as the pane below's box's top line and avoid wasting a line/column for each pane.

  • It seems like it gets confused if the window is bigger than the visible area. Try resize-window -x500 -y500.

@patrick-motard
Copy link
Author

Thank you for the feedback @nicm. Iterating and will get back to you.

@patrick-motard
Copy link
Author

patrick-motard commented Jan 7, 2026

Mouse re-sizing is working. Will push soon.

Screen.Recording.2026-01-06.at.9.10.17.PM.mov

@eMPee584
Copy link

eMPee584 commented Feb 9, 2026

@patrick-motard
By the way, check out set-window-option -g pane-border-indicators arrows along with https://github.com/eMPee584/tmux-pane-flash .. for a different scratch to the same itch: easier visual detectability of the active pane 🙃

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 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.