Adjust screen buffer and PTY sizing for box mode

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.
This commit is contained in:
Patrick Motard 2025-12-06 15:41:53 -06:00
parent 97b8414f2c
commit 487e641e39

View File

@ -1244,6 +1244,29 @@ options_push_changes(const char *name)
RB_FOREACH(w, windows, &windows)
layout_fix_panes(w, NULL);
}
if (strcmp(name, "pane-border-indicators") == 0) {
RB_FOREACH(w, windows, &windows) {
TAILQ_FOREACH(wp, &w->panes, entry) {
u_int screen_sx, screen_sy;
/*
* Resize screen buffer for box mode. The PTY
* size is handled by window_pane_send_resize.
*/
if (window_pane_box_mode(wp) &&
wp->sx >= 3 && wp->sy >= 3) {
screen_sx = wp->sx - 2;
screen_sy = wp->sy - 2;
} else {
screen_sx = wp->sx;
screen_sy = wp->sy;
}
screen_resize(&wp->base, screen_sx, screen_sy,
wp->base.saved_grid == NULL);
window_pane_send_resize(wp, wp->sx, wp->sy);
}
}
}
if (strcmp(name, "codepoint-widths") == 0)
utf8_update_width_cache();
if (strcmp(name, "input-buffer-size") == 0)