From 6dd288d4590942457602a77cef4291c1774dfd8a Mon Sep 17 00:00:00 2001 From: Michael Grant Date: Mon, 1 Jun 2026 20:20:42 +0100 Subject: [PATCH 1/5] Fix bug: pane-border-status top, can't resize floating panes by dragging the border. --- window.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/window.c b/window.c index ba7abafd..97fc7f88 100644 --- a/window.c +++ b/window.c @@ -658,16 +658,11 @@ window_get_active_at(struct window *w, u_int x, u_int y) continue; } } else { - /* Floating - include top or or left border. */ + /* Floating - include all borders. */ if ((int)x < xoff - 1 || x > xoff + sx) continue; - if (pane_status == PANE_STATUS_TOP) { - if ((int)y <= yoff - 2 || y > yoff + sy - 1) - continue; - } else { - if ((int)y < yoff - 1 || y > yoff + sy) - continue; - } + if ((int)y < yoff - 1 || y > yoff + sy) + continue; } return (wp); } From 446aa0828667272287004be7c00d9f994bddbb9b Mon Sep 17 00:00:00 2001 From: Michael Grant Date: Mon, 1 Jun 2026 20:52:51 +0100 Subject: [PATCH 2/5] Bug fix vertical position of scrollbar had wrong vertical offset when status-position top. --- screen-redraw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/screen-redraw.c b/screen-redraw.c index bfdc9215..74d0fc60 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1482,6 +1482,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, int px, py, wx, wy, ox, oy, sx, sy, sb_tty_y; int xoff = wp->xoff; int yoff = wp->yoff; + int sb_wy = sb_y; /* window coordinates */ struct visible_ranges *r; /* @@ -1493,9 +1494,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, ox = ctx->ox; oy = ctx->oy; if (ctx->statustop) { - sb_y += ctx->statuslines; - sy += ctx->statuslines; /* height of window */ - oy += ctx->statuslines; /* top of window */ + sb_y += ctx->statuslines; /* tty coordinates */ + sy += ctx->statuslines; } gc = sb_style->gc; @@ -1527,8 +1527,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, } /* - * sb_y is a window coordinate; convert to tty coordinate by - * subtracting the pan offset oy. + * sb_y is in tty coordinate (window coord + statuslines when + * statustop). Subtract the pan offset oy to get the tty row. */ sb_tty_y = sb_y - oy; /* scrollbar top in tty coordinates */ if (sb_tty_y > (int)sy) { @@ -1550,7 +1550,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, } for (j = jmin; j < jmax; j++) { - wy = sb_y + j; /* window y coordinate */ + wy = sb_wy + j; /* window y coordinate */ py = sb_tty_y + j; /* tty y coordinate */ r = tty_check_overlay_range(tty, sb_x, wy, imax); r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r); From a1873fef619acb858eb6a34078291580f30444e7 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 1 Jun 2026 19:56:26 +0000 Subject: [PATCH 3/5] Only set saved_layout_cell if creating a new cell, avoids crash when respawning pane. Reported by Mingjie Shen in GitHubb issue 5143. --- spawn.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/spawn.c b/spawn.c index dddb3ce1..8a2c36aa 100644 --- a/spawn.c +++ b/spawn.c @@ -271,23 +271,25 @@ spawn_pane(struct spawn_context *sc, char **cause) sc->wp0->ictx = NULL; new_wp = sc->wp0; new_wp->flags &= ~(PANE_STATUSREADY|PANE_STATUSDRAWN); - } else if (sc->lc == NULL) { - new_wp = window_add_pane(w, NULL, hlimit, sc->flags); - layout_init(w, new_wp); } else { - new_wp = window_add_pane(w, sc->wp0, hlimit, sc->flags); - if (sc->flags & SPAWN_ZOOM) - layout_assign_pane(sc->lc, new_wp, 1); - else - layout_assign_pane(sc->lc, new_wp, 0); - } + if (sc->lc == NULL) { + new_wp = window_add_pane(w, NULL, hlimit, sc->flags); + layout_init(w, new_wp); + } else { + new_wp = window_add_pane(w, sc->wp0, hlimit, sc->flags); + if (sc->flags & SPAWN_ZOOM) + layout_assign_pane(sc->lc, new_wp, 1); + else + layout_assign_pane(sc->lc, new_wp, 0); + } - /* - * If window currently zoomed, window_set_active_pane calls - * window_unzoom which it copies back the saved_layout_cell. - */ - if (w->flags & WINDOW_ZOOMED) - new_wp->saved_layout_cell = new_wp->layout_cell; + /* + * If window currently zoomed, window_set_active_pane calls + * window_unzoom which it copies back the saved_layout_cell. + */ + if (w->flags & WINDOW_ZOOMED) + new_wp->saved_layout_cell = new_wp->layout_cell; + } /* * Now we have a pane with nothing running in it ready for the new From 922f7d164510720f3618f1e17ab3eb86f79d6b99 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 1 Jun 2026 19:59:04 +0000 Subject: [PATCH 4/5] Fix resize of floating panes with pane-border-status top, from Michael Grant. --- window.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/window.c b/window.c index 4b4af783..4812fd45 100644 --- a/window.c +++ b/window.c @@ -637,16 +637,11 @@ window_get_active_at(struct window *w, u_int x, u_int y) continue; } } else { - /* Floating - include top or or left border. */ + /* Floating - include all borders. */ if ((int)x < xoff - 1 || x > xoff + sx) continue; - if (pane_status == PANE_STATUS_TOP) { - if ((int)y <= yoff - 2 || y > yoff + sy - 1) - continue; - } else { - if ((int)y < yoff - 1 || y > yoff + sy) - continue; - } + if ((int)y < yoff - 1 || y > yoff + sy) + continue; } return (wp); } From 3269833caa61093513e27f076ca7772a6c1c07fd Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 1 Jun 2026 20:00:25 +0000 Subject: [PATCH 5/5] Fix vertical position of scrollbar having wrong vertical offset when status-position top, from Michael Grant. --- screen-redraw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/screen-redraw.c b/screen-redraw.c index 35e4b9ef..4ba6d685 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -1476,6 +1476,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, int px, py, wx, wy, ox, oy, sx, sy, sb_tty_y; int xoff = wp->xoff; int yoff = wp->yoff; + int sb_wy = sb_y; /* window coordinates */ struct visible_ranges *r; /* @@ -1487,9 +1488,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, ox = ctx->ox; oy = ctx->oy; if (ctx->statustop) { - sb_y += ctx->statuslines; - sy += ctx->statuslines; /* height of window */ - oy += ctx->statuslines; /* top of window */ + sb_y += ctx->statuslines; /* tty coordinates */ + sy += ctx->statuslines; } gc = sb_style->gc; @@ -1521,8 +1521,8 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, } /* - * sb_y is a window coordinate; convert to tty coordinate by - * subtracting the pan offset oy. + * sb_y is in tty coordinate (window coord + statuslines when + * statustop). Subtract the pan offset oy to get the tty row. */ sb_tty_y = sb_y - oy; /* scrollbar top in tty coordinates */ if (sb_tty_y > (int)sy) { @@ -1544,7 +1544,7 @@ screen_redraw_draw_scrollbar(struct screen_redraw_ctx *ctx, } for (j = jmin; j < jmax; j++) { - wy = sb_y + j; /* window y coordinate */ + wy = sb_wy + j; /* window y coordinate */ py = sb_tty_y + j; /* tty y coordinate */ r = tty_check_overlay_range(tty, sb_x, wy, imax); r = screen_redraw_get_visible_ranges(wp, sb_x, wy, imax, r);