From: nicm Date: Thu, 21 Mar 2024 11:51:32 +0000 (+0000) Subject: Add -M to always turn mouse on in a menu, GitHub issue 3779. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=324571b213835c9f40cc01bc4cb00052d5530132;p=openbsd Add -M to always turn mouse on in a menu, GitHub issue 3779. --- diff --git a/usr.bin/tmux/cmd-display-menu.c b/usr.bin/tmux/cmd-display-menu.c index 5f0a011e5d4..23887390cff 100644 --- a/usr.bin/tmux/cmd-display-menu.c +++ b/usr.bin/tmux/cmd-display-menu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-menu.c,v 1.42 2023/08/15 07:01:47 nicm Exp $ */ +/* $OpenBSD: cmd-display-menu.c,v 1.43 2024/03/21 11:51:32 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott @@ -39,8 +39,8 @@ const struct cmd_entry cmd_display_menu_entry = { .name = "display-menu", .alias = "menu", - .args = { "b:c:C:H:s:S:Ot:T:x:y:", 1, -1, cmd_display_menu_args_parse }, - .usage = "[-O] [-b border-lines] [-c target-client] " + .args = { "b:c:C:H:s:S:MOt:T:x:y:", 1, -1, cmd_display_menu_args_parse }, + .usage = "[-MO] [-b border-lines] [-c target-client] " "[-C starting-choice] [-H selected-style] [-s style] " "[-S border-style] " CMD_TARGET_PANE_USAGE "[-T title] " "[-x position] [-y position] name key command ...", @@ -374,7 +374,7 @@ cmd_display_menu_exec(struct cmd *self, struct cmdq_item *item) if (args_has(args, 'O')) flags |= MENU_STAYOPEN; - if (!event->m.valid) + if (!event->m.valid && !args_has(args, 'M')) flags |= MENU_NOMOUSE; if (menu_display(menu, flags, starting_choice, item, px, py, tc, lines, style, selected_style, border_style, target, NULL, NULL) != 0) diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 658bb25e056..1989e4c1ece 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.938 2024/03/21 11:32:49 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.939 2024/03/21 11:51:32 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -6116,7 +6116,7 @@ the default is .Ql y . .Tg menu .It Xo Ic display-menu -.Op Fl O +.Op Fl OM .Op Fl b Ar border-lines .Op Fl c Ar target-client .Op Fl C Ar starting-choice @@ -6223,7 +6223,13 @@ changes this behaviour so that the menu does not close when the mouse button is released without an item selected the menu is not closed and a mouse button must be clicked to choose an item. .Pp -The following keys are also available: +.Fl M +tells +.Nm +the menu should handle mouse events; by default only menus opened from mouse +key bindings do so. +.Pp +The following keys are available in menus: .Bl -column "Key" "Function" -offset indent .It Sy "Key" Ta Sy "Function" .It Li "Enter" Ta "Choose selected item"