diff --git a/format.c b/format.c index 9354b5a24..233626e81 100644 --- a/format.c +++ b/format.c @@ -1,4 +1,4 @@ -/* $OpenBSD: format.c,v 1.405 2026/07/15 13:02:33 nicm Exp $ */ +/* $OpenBSD: format.c,v 1.406 2026/07/19 17:36:38 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -2564,6 +2564,75 @@ format_cb_pane_tty(struct format_tree *ft) return (NULL); } +/* Callback for pane_unzoomed_height. */ +static void * +format_cb_pane_unzoomed_height(struct format_tree *ft) +{ + struct window_pane *wp = ft->wp; + struct window *w; + struct layout_cell *lc, *root; + int status; + u_int sy; + + if (wp == NULL) + return (NULL); + w = wp->window; + + lc = wp->saved_layout_cell; + if (lc == NULL) + lc = wp->layout_cell; + if (lc == NULL) + return (NULL); + sy = lc->g.sy; + + root = w->saved_layout_root; + if (root == NULL) + root = w->layout_root; + status = window_pane_get_pane_status(wp); + if (!window_pane_is_floating(wp) && + root != NULL && + layout_add_horizontal_border(root, lc, status) && + sy > 1) + sy--; + + return (format_printf("%u", sy)); +} + +/* Callback for pane_unzoomed_width. */ +static void * +format_cb_pane_unzoomed_width(struct format_tree *ft) +{ + struct window_pane *wp = ft->wp; + struct layout_cell *lc; + int sb_w, sb_pad; + u_int sx; + + if (wp == NULL) + return (NULL); + + lc = wp->saved_layout_cell; + if (lc == NULL) + lc = wp->layout_cell; + if (lc == NULL) + return (NULL); + sx = lc->g.sx; + + if (window_pane_scrollbar_reserve(wp)) { + sb_w = wp->scrollbar_style.width; + sb_pad = wp->scrollbar_style.pad; + if (sb_w < 1) + sb_w = 1; + if (sb_pad < 0) + sb_pad = 0; + if ((int)sx - sb_w - sb_pad < PANE_MINIMUM) + sx = PANE_MINIMUM; + else + sx -= sb_w + sb_pad; + } + + return (format_printf("%u", sx)); +} + /* Callback for pane_width. */ static void * format_cb_pane_width(struct format_tree *ft) @@ -3746,6 +3815,12 @@ static const struct format_table_entry format_table[] = { { "pane_unseen_changes", FORMAT_TABLE_STRING, format_cb_pane_unseen_changes }, + { "pane_unzoomed_height", FORMAT_TABLE_STRING, + format_cb_pane_unzoomed_height + }, + { "pane_unzoomed_width", FORMAT_TABLE_STRING, + format_cb_pane_unzoomed_width + }, { "pane_width", FORMAT_TABLE_STRING, format_cb_pane_width }, diff --git a/options-table.c b/options-table.c index dabf53934..82ae2e5ff 100644 --- a/options-table.c +++ b/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.238 2026/07/15 13:02:33 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.239 2026/07/19 17:36:38 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott @@ -1349,7 +1349,8 @@ const struct options_table_entry options_table[] = { { .name = "display-panes-format", .type = OPTIONS_TABLE_STRING, .scope = OPTIONS_TABLE_WINDOW, - .default_str = "#[align=right]#{pane_width}x#{pane_height}", + .default_str = "#[align=right]" + "#{pane_unzoomed_width}x#{pane_unzoomed_height}", .text = "Format of text shown by 'display-panes', expanded for each " "pane." }, diff --git a/tmux.1 b/tmux.1 index 59339d365..8d433131b 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.1143 2026/07/17 12:42:51 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.1144 2026/07/19 17:36:38 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 17 2026 $ +.Dd $Mdocdate: July 19 2026 $ .Dt TMUX 1 .Os .Sh NAME @@ -7333,6 +7333,8 @@ The following variables are available, where appropriate: .It Li "pane_top" Ta "" Ta "Top of pane" .It Li "pane_tty" Ta "" Ta "Pseudo terminal of pane" .It Li "pane_unseen_changes" Ta "" Ta "1 if there were changes in pane while in mode" +.It Li "pane_unzoomed_height" Ta "" Ta "Height of pane when not zoomed" +.It Li "pane_unzoomed_width" Ta "" Ta "Width of pane when not zoomed" .It Li "pane_width" Ta "" Ta "Width of pane" .It Li "pane_x" Ta "" Ta "X position of pane" .It Li "pane_y" Ta "" Ta "Y position of pane"