Merge branch 'master' into command_parser

This commit is contained in:
Nicholas Marriott
2026-07-29 13:37:36 +01:00
4 changed files with 79 additions and 6 deletions

View File

@@ -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

66
regress/menu-mouse.sh Normal file
View File

@@ -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

View File

@@ -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 <nicholas.marriott@gmail.com>
@@ -1682,6 +1682,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) {
@@ -1689,8 +1692,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;

6
tmux.1
View File

@@ -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 <nicholas.marriott@gmail.com>
.\"
@@ -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
@@ -8754,7 +8754,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