mirror of
https://github.com/tmux/tmux.git
synced 2026-10-10 12:14:43 +00:00
Merge remote-tracking branch 'refs/remotes/tmux-openbsd/master'
* refs/remotes/tmux-openbsd/master: Do not use subtraction for comparators, this doesn't really matter for IDs but it breaks key sorting. GitHub issue 5646 from Alexandre Fiori. Fix dragging a floating pane by its top border over a tiled pane's status line, GitHub issue 5645 from Michael Grant. Fix floating panes not being detected as obscuring the pane behind them, GitHub issue 5641 from Michael Grant. Exit 128 + SIGHUP like popups did if waiting for a pane that was killed, from Alexandre Fiori.
This commit is contained in:
14
hyperlinks.c
14
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 <author@will.party>
|
* Copyright (c) 2021 Will <author@will.party>
|
||||||
@@ -87,7 +87,11 @@ hyperlinks_by_uri_cmp(struct hyperlinks_uri *left, struct hyperlinks_uri *right)
|
|||||||
return (-1);
|
return (-1);
|
||||||
if (*right->internal_id != '\0')
|
if (*right->internal_id != '\0')
|
||||||
return (1);
|
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);
|
r = strcmp(left->internal_id, right->internal_id);
|
||||||
@@ -104,7 +108,11 @@ static int
|
|||||||
hyperlinks_by_inner_cmp(struct hyperlinks_uri *left,
|
hyperlinks_by_inner_cmp(struct hyperlinks_uri *left,
|
||||||
struct hyperlinks_uri *right)
|
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,
|
RB_PROTOTYPE_STATIC(hyperlinks_by_inner_tree, hyperlinks_uri, by_inner_entry,
|
||||||
hyperlinks_by_inner_cmp);
|
hyperlinks_by_inner_cmp);
|
||||||
|
|||||||
@@ -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 <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -201,15 +201,7 @@ screen_write_pane_is_obscured(struct screen_write_ctx *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ((wp = TAILQ_PREV(wp, window_panes, zentry)) != NULL) {
|
while ((wp = TAILQ_PREV(wp, window_panes, zentry)) != NULL) {
|
||||||
if (window_pane_is_floating(wp) &&
|
if (window_pane_floating_overlaps(wp, ctx->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))) {
|
|
||||||
ctx->flags |= SCREEN_WRITE_OBSCURED;
|
ctx->flags |= SCREEN_WRITE_OBSCURED;
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|||||||
48
sort.c
48
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 <dhcjensen@gmail.com>
|
* Copyright (c) 2026 Dane Jensen <dhcjensen@gmail.com>
|
||||||
@@ -25,6 +25,16 @@
|
|||||||
|
|
||||||
static struct sort_criteria *sort_criteria;
|
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
|
static void
|
||||||
sort_qsort(void *l, u_int len, u_int size, int (*cmp)(const void *,
|
sort_qsort(void *l, u_int len, u_int size, int (*cmp)(const void *,
|
||||||
const void *), struct sort_criteria *sort_crit)
|
const void *), struct sort_criteria *sort_crit)
|
||||||
@@ -73,7 +83,7 @@ sort_buffer_cmp(const void *a0, const void *b0)
|
|||||||
result = 0;
|
result = 0;
|
||||||
break;
|
break;
|
||||||
case SORT_SIZE:
|
case SORT_SIZE:
|
||||||
result = pa->size - pb->size;
|
result = sort_number_cmp(pa->size, pb->size);
|
||||||
break;
|
break;
|
||||||
case SORT_ACTIVITY:
|
case SORT_ACTIVITY:
|
||||||
case SORT_INDEX:
|
case SORT_INDEX:
|
||||||
@@ -107,9 +117,9 @@ sort_client_cmp(const void *a0, const void *b0)
|
|||||||
result = strcmp(ca->name, cb->name);
|
result = strcmp(ca->name, cb->name);
|
||||||
break;
|
break;
|
||||||
case SORT_SIZE:
|
case SORT_SIZE:
|
||||||
result = ca->tty.sx - cb->tty.sx;
|
result = sort_number_cmp(ca->tty.sx, cb->tty.sx);
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
result = ca->tty.sy - cb->tty.sy;
|
result = sort_number_cmp(ca->tty.sy, cb->tty.sy);
|
||||||
break;
|
break;
|
||||||
case SORT_CREATION:
|
case SORT_CREATION:
|
||||||
if (timercmp(&ca->creation_time, &cb->creation_time, >))
|
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) {
|
switch (sort_crit->order) {
|
||||||
case SORT_INDEX:
|
case SORT_INDEX:
|
||||||
result = sa->id - sb->id;
|
result = sort_number_cmp(sa->id, sb->id);
|
||||||
break;
|
break;
|
||||||
case SORT_CREATION:
|
case SORT_CREATION:
|
||||||
if (timercmp(&sa->creation_time, &sb->creation_time, >)) {
|
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) {
|
switch (sort_crit->order) {
|
||||||
case SORT_ACTIVITY:
|
case SORT_ACTIVITY:
|
||||||
result = a->active_point - b->active_point;
|
result = sort_number_cmp(a->active_point, b->active_point);
|
||||||
break;
|
break;
|
||||||
case SORT_CREATION:
|
case SORT_CREATION:
|
||||||
result = a->id - b->id;
|
result = sort_number_cmp(a->id, b->id);
|
||||||
break;
|
break;
|
||||||
case SORT_SIZE:
|
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;
|
break;
|
||||||
case SORT_INDEX:
|
case SORT_INDEX:
|
||||||
window_pane_index(a, &ai);
|
window_pane_index(a, &ai);
|
||||||
window_pane_index(b, &bi);
|
window_pane_index(b, &bi);
|
||||||
result = ai - bi;
|
result = sort_number_cmp(ai, bi);
|
||||||
break;
|
break;
|
||||||
case SORT_NAME:
|
case SORT_NAME:
|
||||||
result = strcmp(a->screen->title, b->screen->title);
|
result = strcmp(a->screen->title, b->screen->title);
|
||||||
@@ -222,7 +232,7 @@ sort_pane_cmp(const void *a0, const void *b0)
|
|||||||
case SORT_Z:
|
case SORT_Z:
|
||||||
window_pane_zindex(a, &ai);
|
window_pane_zindex(a, &ai);
|
||||||
window_pane_zindex(b, &bi);
|
window_pane_zindex(b, &bi);
|
||||||
result = ai - bi;
|
result = sort_number_cmp(ai, bi);
|
||||||
break;
|
break;
|
||||||
case SORT_MODIFIER:
|
case SORT_MODIFIER:
|
||||||
case SORT_ORDER:
|
case SORT_ORDER:
|
||||||
@@ -278,7 +288,7 @@ sort_winlink_cmp(const void *a0, const void *b0)
|
|||||||
result = strcmp(wa->name, wb->name);
|
result = strcmp(wa->name, wb->name);
|
||||||
break;
|
break;
|
||||||
case SORT_SIZE:
|
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;
|
break;
|
||||||
case SORT_MODIFIER:
|
case SORT_MODIFIER:
|
||||||
case SORT_ORDER:
|
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 *a = *(struct key_binding **)a0;
|
||||||
const struct key_binding *b = *(struct key_binding **)b0;
|
const struct key_binding *b = *(struct key_binding **)b0;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
key_code ak, bk;
|
||||||
|
|
||||||
switch (sort_crit->order) {
|
switch (sort_crit->order) {
|
||||||
case SORT_INDEX:
|
case SORT_INDEX:
|
||||||
result = a->key - b->key;
|
result = sort_number_cmp(a->key, b->key);
|
||||||
break;
|
break;
|
||||||
case SORT_MODIFIER:
|
case SORT_MODIFIER:
|
||||||
result = (a->key & KEYC_MASK_MODIFIERS) -
|
ak = (a->key & KEYC_MASK_MODIFIERS);
|
||||||
(b->key & KEYC_MASK_MODIFIERS);
|
bk = (b->key & KEYC_MASK_MODIFIERS);
|
||||||
|
result = sort_number_cmp(ak, bk);
|
||||||
break;
|
break;
|
||||||
case SORT_NAME:
|
case SORT_NAME:
|
||||||
result = strcasecmp(a->tablename, b->tablename);
|
result = strcasecmp(a->tablename, b->tablename);
|
||||||
@@ -325,12 +337,8 @@ sort_key_binding_cmp(const void *a0, const void *b0)
|
|||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
result = strcasecmp(a->tablename, b->tablename);
|
result = strcasecmp(a->tablename, b->tablename);
|
||||||
if (result == 0) {
|
if (result == 0)
|
||||||
if (a->key < b->key)
|
result = sort_number_cmp(a->key, b->key);
|
||||||
result = -1;
|
|
||||||
else if (a->key > b->key)
|
|
||||||
result = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sort_crit->reversed)
|
if (sort_crit->reversed)
|
||||||
result = -result;
|
result = -result;
|
||||||
|
|||||||
4
tmux.h
4
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 <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -3705,6 +3705,8 @@ struct window_pane *window_find_string(struct window *, const char *);
|
|||||||
int window_has_floating_panes(struct window *);
|
int window_has_floating_panes(struct window *);
|
||||||
int window_has_pane(struct window *, struct window_pane *);
|
int window_has_pane(struct window *, struct window_pane *);
|
||||||
int window_pane_contains(struct window_pane *, u_int, u_int);
|
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 window_set_active_pane(struct window *, struct window_pane *,
|
||||||
int);
|
int);
|
||||||
void window_fire_pane_moved(struct window_pane *, struct window *,
|
void window_fire_pane_moved(struct window_pane *, struct window *,
|
||||||
|
|||||||
54
window.c
54
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.383 2026/09/28 10:42:01 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -92,7 +92,11 @@ struct window_pane_prompt {
|
|||||||
int
|
int
|
||||||
window_cmp(struct window *w1, struct window *w2)
|
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
|
static void
|
||||||
@@ -199,7 +203,11 @@ winlink_cmp(struct winlink *wl1, struct winlink *wl2)
|
|||||||
int
|
int
|
||||||
window_pane_cmp(struct window_pane *wp1, struct window_pane *wp2)
|
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 *
|
struct winlink *
|
||||||
@@ -667,6 +675,34 @@ window_pane_contains(struct window_pane *wp, u_int x, u_int y)
|
|||||||
return (1);
|
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
|
void
|
||||||
window_update_focus(struct window *w)
|
window_update_focus(struct window *w)
|
||||||
{
|
{
|
||||||
@@ -823,6 +859,16 @@ window_get_active_at(struct window *w, u_int x, u_int y)
|
|||||||
return (NULL);
|
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) {
|
if (pane_status == PANE_STATUS_TOP) {
|
||||||
/*
|
/*
|
||||||
* Prefer a pane's top border status line over the pane above's
|
* Prefer a pane's top border status line over the pane above's
|
||||||
@@ -1440,7 +1486,7 @@ window_pane_wait_finish(struct window_pane *wp)
|
|||||||
{
|
{
|
||||||
struct cmdq_item *item = wp->wait_item;
|
struct cmdq_item *item = wp->wait_item;
|
||||||
struct client *c;
|
struct client *c;
|
||||||
int retval = 0;
|
int retval = 128 + SIGHUP;
|
||||||
|
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user