From 7cc0c11cde1b9e9ad193cbd2d10e01b0d6dbaa55 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 28 Jul 2026 14:18:02 +0100 Subject: [PATCH 1/4] Add test for mouse menu position. --- regress/menu-mouse.sh | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 regress/menu-mouse.sh diff --git a/regress/menu-mouse.sh b/regress/menu-mouse.sh new file mode 100644 index 000000000..e1b53b55f --- /dev/null +++ b/regress/menu-mouse.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +# Check that mouse selection in an active menu uses the correct coordinates +# when the status line is at the top. + +PATH=/bin:/usr/bin +TERM=screen + +[ -z "$TEST_TMUX" ] && TEST_TMUX=$(readlink -f ../tmux) +TMUX="$TEST_TMUX -LtestA$$ -f/dev/null" +TMUX2="$TEST_TMUX -LtestB$$ -f/dev/null" + +cleanup() +{ + $TMUX kill-server >/dev/null 2>&1 + $TMUX2 kill-server >/dev/null 2>&1 +} +fail() +{ + echo "$*" >&2 + cleanup + exit 1 +} + +# click COL ROW +# +# Write an SGR mouse press then release at a 1-based position to the outer pane +# holding the inner client. +click() +{ + col="$1" + row="$2" + + seq=$(printf '\033[<0;%s;%sM\033[<0;%s;%sm' \ + "$col" "$row" "$col" "$row") + $TMUX2 send-keys -t "$OUTER" -l "$seq" 2>/dev/null + sleep 1 +} + +cleanup + +$TMUX new-session -d -s inner -x 80 -y 24 'sleep 100' || exit 1 +$TMUX set -g mouse on || exit 1 +$TMUX set -g status-position top || exit 1 +$TMUX set -g @menu-choice '' || exit 1 + +$TMUX2 new-session -d -x 80 -y 24 "$TMUX attach -t inner" || exit 1 +sleep 1 +OUTER=$($TMUX2 list-panes -F '#{pane_id}' | head -1) +[ -n "$OUTER" ] || fail "No outer pane." + +$TMUX display-menu -M -x 5 -y 7 \ + "First item" f "set -g @menu-choice first" \ + "Second item" s "set -g @menu-choice second" || exit 1 +sleep 1 + +# -y is the bottom of the menu, so with four menu lines this puts the menu at +# window y=3. The first item is then at window y=4. With one status line at the +# top, this is terminal row 6 in SGR's 1-based coordinates. +click 8 6 + +choice=$($TMUX show -gv @menu-choice 2>/dev/null) +[ "$choice" = "first" ] || fail "got '$choice', expected 'first'" + +cleanup +exit 0 From 9f2c535909ae0a369e6006b9cf32d8186c6a3788 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 28 Jul 2026 13:17:45 +0000 Subject: [PATCH 2/4] Store status position in new mouse event for menus so the position is correct later. --- server-client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server-client.c b/server-client.c index 081862e43..d389dacef 100644 --- a/server-client.c +++ b/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.499 2026/07/22 08:19:14 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.500 2026/07/28 13:17:45 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -1687,6 +1687,9 @@ server_client_handle_menu_key(struct client *c, struct key_event *event) memcpy(&new_event, event, sizeof new_event); if (KEYC_IS_MOUSE(event->key)) { m = &new_event.m; + m->statusat = status_at_line(c); + m->statuslines = status_line_size(c); + tty_window_offset(&c->tty, &ox, &oy, &sx, &sy); m->x += ox; if (m->statusat == 0) { @@ -1694,8 +1697,7 @@ server_client_handle_menu_key(struct client *c, struct key_event *event) m->x = m->y = UINT_MAX; else m->y = m->y - m->statuslines + oy; - } else if (m->statusat > 0 && - m->y >= (u_int)m->statusat) + } else if (m->statusat > 0 && m->y >= (u_int)m->statusat) m->x = m->y = UINT_MAX; else m->y += oy; From 6f41dac8983cbab517413d4200fde232828eb576 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 29 Jul 2026 08:58:33 +0000 Subject: [PATCH 3/4] Fix #1 -> #{1} in tmux1, from Rasmus Thystrup Karstensen. --- tmux.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmux.1 b/tmux.1 index ed8f1b5be..cb5e1aee7 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.1151 2026/07/28 07:04:18 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.1152 2026/07/29 08:58:33 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 28 2026 $ +.Dd $Mdocdate: July 29 2026 $ .Dt TMUX 1 .Os .Sh NAME @@ -8750,7 +8750,7 @@ values are given, they are available as and so on. For example: .Bd -literal -offset indent -run-shell 'myscript.sh #1 #2' foo bar +run-shell 'myscript.sh #{1} #{2}' foo bar .Ed .Pp With From d6c37ce314667c71c6c80cd194706daabf62ae0b Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 29 Jul 2026 11:10:49 +0100 Subject: [PATCH 4/4] Note SIXEL at end of configure as well. --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index 549f4a3b3..b09bc5d4e 100644 --- a/configure.ac +++ b/configure.ac @@ -1137,6 +1137,11 @@ if test "x$enable_asan" = xyes; then else AC_MSG_NOTICE([ASAN: off]) fi +if test "x$enable_sixel" = xyes; then + AC_MSG_NOTICE([SIXEL: on]) +else + AC_MSG_NOTICE([SIXEL: off]) +fi if test "x$enable_debug" = xyes; then AC_MSG_NOTICE([debug: on]) else