From 884101263e12a5788b590860bfa405c3d9f4499f Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 28 Sep 2026 09:56:05 +0000 Subject: [PATCH 1/4] Exit 128 + SIGHUP like popups did if waiting for a pane that was killed, from Alexandre Fiori. --- window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/window.c b/window.c index 86cd0c6e3..6f112c984 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.379 2026/09/25 08:46:06 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.380 2026/09/28 09:56:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1433,7 +1433,7 @@ window_pane_wait_finish(struct window_pane *wp) { struct cmdq_item *item = wp->wait_item; struct client *c; - int retval = 0; + int retval = 128 + SIGHUP; if (item == NULL) return; From bbecdc802fd79c0917a9bc742a29aa2b94afcdfc Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 28 Sep 2026 10:10:16 +0000 Subject: [PATCH 2/4] Fix floating panes not being detected as obscuring the pane behind them, GitHub issue 5641 from Michael Grant. --- screen-write.c | 12 ++---------- tmux.h | 4 +++- window.c | 30 +++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/screen-write.c b/screen-write.c index 0c14838db..6e3d46661 100644 --- a/screen-write.c +++ b/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.293 2026/09/24 11:19:39 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.294 2026/09/28 10:10:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -201,15 +201,7 @@ screen_write_pane_is_obscured(struct screen_write_ctx *ctx) } while ((wp = TAILQ_PREV(wp, window_panes, zentry)) != NULL) { - if (window_pane_is_floating(wp) && - ((wp->yoff >= ctx->wp->yoff && - wp->yoff <= ctx->wp->yoff + (int)ctx->wp->sy) || - (wp->yoff + (int)wp->sy >= ctx->wp->yoff && - wp->yoff + wp->sy <= ctx->wp->yoff + ctx->wp->sy)) && - ((wp->xoff >= ctx->wp->xoff && - wp->xoff <= ctx->wp->xoff + (int)ctx->wp->sx) || - (wp->xoff + (int)wp->sx >= ctx->wp->xoff && - wp->xoff + wp->sx <= ctx->wp->xoff + ctx->wp->sx))) { + if (window_pane_floating_overlaps(wp, ctx->wp)) { ctx->flags |= SCREEN_WRITE_OBSCURED; return (1); } diff --git a/tmux.h b/tmux.h index cb2de001f..9fac8a2ec 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1448 2026/09/24 11:19:39 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1449 2026/09/28 10:10:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -3655,6 +3655,8 @@ struct window_pane *window_find_string(struct window *, const char *); int window_has_floating_panes(struct window *); int window_has_pane(struct window *, struct window_pane *); int window_pane_contains(struct window_pane *, u_int, u_int); +int window_pane_floating_overlaps(struct window_pane *, + struct window_pane *); int window_set_active_pane(struct window *, struct window_pane *, int); void window_fire_pane_moved(struct window_pane *, struct window *, diff --git a/window.c b/window.c index 6f112c984..8ce484d26 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.380 2026/09/28 09:56:05 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.381 2026/09/28 10:10:16 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -660,6 +660,34 @@ window_pane_contains(struct window_pane *wp, u_int x, u_int y) return (1); } +/* + * Does floating pane, including its borders and scrollbar, overlap any cell of + * another pane, including its scrollbar? + */ +int +window_pane_floating_overlaps(struct window_pane *fwp, struct window_pane *wp) +{ + int fxoff, fyoff, xoff, yoff, border = 0; + u_int fsx, fsy, sx, sy; + + if (!window_pane_is_floating(fwp)) + return (0); + + window_pane_full_size_offset(fwp, &fxoff, &fyoff, &fsx, &fsy); + window_pane_full_size_offset(wp, &xoff, &yoff, &sx, &sy); + + if (window_pane_get_pane_lines(fwp) != PANE_LINES_NONE) + border = 1; + + if (fxoff - border >= xoff + (int)sx || + fxoff + (int)fsx + border <= xoff) + return (0); + if (fyoff - border >= yoff + (int)sy || + fyoff + (int)fsy + border <= yoff) + return (0); + return (1); +} + void window_update_focus(struct window *w) { From a16e62849d6497f35fb8dd49b522da363083ffd6 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 28 Sep 2026 10:25:43 +0000 Subject: [PATCH 3/4] Fix dragging a floating pane by its top border over a tiled pane's status line, GitHub issue 5645 from Michael Grant. --- window.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/window.c b/window.c index 8ce484d26..e93a854f9 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.381 2026/09/28 10:10:16 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.382 2026/09/28 10:25:43 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -844,6 +844,16 @@ window_get_active_at(struct window *w, u_int x, u_int y) return (NULL); } + /* + * A floating pane is above every tiled pane, including their status + * lines, so check those first. + */ + TAILQ_FOREACH(wp, &w->z_index, zentry) { + if (window_pane_is_floating(wp) && + window_pane_contains(wp, x, y)) + return (wp); + } + if (pane_status == PANE_STATUS_TOP) { /* * Prefer a pane's top border status line over the pane above's From db3950ed07524ef62124b42b000a7f5d32d6eddb Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 28 Sep 2026 10:42:01 +0000 Subject: [PATCH 4/4] Do not use subtraction for comparators, this doesn't really matter for IDs but it breaks key sorting. GitHub issue 5646 from Alexandre Fiori. --- hyperlinks.c | 14 +++++++++++--- sort.c | 48 ++++++++++++++++++++++++++++-------------------- window.c | 14 +++++++++++--- 3 files changed, 50 insertions(+), 26 deletions(-) diff --git a/hyperlinks.c b/hyperlinks.c index 1820fdad2..b86124ff5 100644 --- a/hyperlinks.c +++ b/hyperlinks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hyperlinks.c,v 1.5 2026/06/29 16:44:06 nicm Exp $ */ +/* $OpenBSD: hyperlinks.c,v 1.6 2026/09/28 10:42:01 nicm Exp $ */ /* * Copyright (c) 2021 Will @@ -88,7 +88,11 @@ hyperlinks_by_uri_cmp(struct hyperlinks_uri *left, struct hyperlinks_uri *right) return (-1); if (*right->internal_id != '\0') return (1); - return (left->inner - right->inner); + if (left->inner < right->inner) + return (-1); + if (left->inner > right->inner) + return (1); + return (0); } r = strcmp(left->internal_id, right->internal_id); @@ -105,7 +109,11 @@ static int hyperlinks_by_inner_cmp(struct hyperlinks_uri *left, struct hyperlinks_uri *right) { - return (left->inner - right->inner); + if (left->inner < right->inner) + return (-1); + if (left->inner > right->inner) + return (1); + return (0); } RB_PROTOTYPE_STATIC(hyperlinks_by_inner_tree, hyperlinks_uri, by_inner_entry, hyperlinks_by_inner_cmp); diff --git a/sort.c b/sort.c index 3b4d77301..ab3f5905b 100644 --- a/sort.c +++ b/sort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sort.c,v 1.11 2026/09/28 09:41:53 nicm Exp $ */ +/* $OpenBSD: sort.c,v 1.12 2026/09/28 10:42:01 nicm Exp $ */ /* * Copyright (c) 2026 Dane Jensen @@ -25,6 +25,16 @@ static struct sort_criteria *sort_criteria; +static int +sort_number_cmp(unsigned long long a, unsigned long long b) +{ + if (a < b) + return (-1); + if (a > b) + return (1); + return (0); +} + static void sort_qsort(void *l, u_int len, u_int size, int (*cmp)(const void *, const void *), struct sort_criteria *sort_crit) @@ -73,7 +83,7 @@ sort_buffer_cmp(const void *a0, const void *b0) result = 0; break; case SORT_SIZE: - result = pa->size - pb->size; + result = sort_number_cmp(pa->size, pb->size); break; case SORT_ACTIVITY: case SORT_INDEX: @@ -107,9 +117,9 @@ sort_client_cmp(const void *a0, const void *b0) result = strcmp(ca->name, cb->name); break; case SORT_SIZE: - result = ca->tty.sx - cb->tty.sx; + result = sort_number_cmp(ca->tty.sx, cb->tty.sx); if (result == 0) - result = ca->tty.sy - cb->tty.sy; + result = sort_number_cmp(ca->tty.sy, cb->tty.sy); break; case SORT_CREATION: if (timercmp(&ca->creation_time, &cb->creation_time, >)) @@ -151,7 +161,7 @@ sort_session_cmp(const void *a0, const void *b0) switch (sort_crit->order) { case SORT_INDEX: - result = sa->id - sb->id; + result = sort_number_cmp(sa->id, sb->id); break; case SORT_CREATION: if (timercmp(&sa->creation_time, &sb->creation_time, >)) { @@ -203,18 +213,18 @@ sort_pane_cmp(const void *a0, const void *b0) switch (sort_crit->order) { case SORT_ACTIVITY: - result = a->active_point - b->active_point; + result = sort_number_cmp(a->active_point, b->active_point); break; case SORT_CREATION: - result = a->id - b->id; + result = sort_number_cmp(a->id, b->id); break; case SORT_SIZE: - result = a->sx * a->sy - b->sx * b->sy; + result = sort_number_cmp(a->sx * a->sy, b->sx * b->sy); break; case SORT_INDEX: window_pane_index(a, &ai); window_pane_index(b, &bi); - result = ai - bi; + result = sort_number_cmp(ai, bi); break; case SORT_NAME: result = strcmp(a->screen->title, b->screen->title); @@ -222,7 +232,7 @@ sort_pane_cmp(const void *a0, const void *b0) case SORT_Z: window_pane_zindex(a, &ai); window_pane_zindex(b, &bi); - result = ai - bi; + result = sort_number_cmp(ai, bi); break; case SORT_MODIFIER: case SORT_ORDER: @@ -278,7 +288,7 @@ sort_winlink_cmp(const void *a0, const void *b0) result = strcmp(wa->name, wb->name); break; case SORT_SIZE: - result = wa->sx * wa->sy - wb->sx * wb->sy; + result = sort_number_cmp(wa->sx * wa->sy, wb->sx * wb->sy); break; case SORT_MODIFIER: case SORT_ORDER: @@ -302,14 +312,16 @@ sort_key_binding_cmp(const void *a0, const void *b0) const struct key_binding *a = *(struct key_binding **)a0; const struct key_binding *b = *(struct key_binding **)b0; int result = 0; + key_code ak, bk; switch (sort_crit->order) { case SORT_INDEX: - result = a->key - b->key; + result = sort_number_cmp(a->key, b->key); break; case SORT_MODIFIER: - result = (a->key & KEYC_MASK_MODIFIERS) - - (b->key & KEYC_MASK_MODIFIERS); + ak = (a->key & KEYC_MASK_MODIFIERS); + bk = (b->key & KEYC_MASK_MODIFIERS); + result = sort_number_cmp(ak, bk); break; case SORT_NAME: result = strcasecmp(a->tablename, b->tablename); @@ -325,12 +337,8 @@ sort_key_binding_cmp(const void *a0, const void *b0) if (result == 0) result = strcasecmp(a->tablename, b->tablename); - if (result == 0) { - if (a->key < b->key) - result = -1; - else if (a->key > b->key) - result = 1; - } + if (result == 0) + result = sort_number_cmp(a->key, b->key); if (sort_crit->reversed) result = -result; diff --git a/window.c b/window.c index e93a854f9..a2f64ed85 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.382 2026/09/28 10:25:43 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.383 2026/09/28 10:42:01 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -94,7 +94,11 @@ struct window_pane_prompt { int window_cmp(struct window *w1, struct window *w2) { - return (w1->id - w2->id); + if (w1->id < w2->id) + return (-1); + if (w1->id > w2->id) + return (1); + return (0); } static void @@ -201,7 +205,11 @@ winlink_cmp(struct winlink *wl1, struct winlink *wl2) int window_pane_cmp(struct window_pane *wp1, struct window_pane *wp2) { - return (wp1->id - wp2->id); + if (wp1->id < wp2->id) + return (-1); + if (wp1->id > wp2->id) + return (1); + return (0); } struct winlink *