summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-09-16 13:27:15 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-09-16 13:27:15 +0000
commita5a0fe45824d4d35e09b19310cb50afd67732f04 (patch)
treea8406f4d6b76eea9da3c7c96b47a82402e8bfbd6 /usr.bin/tmux
parent8e00514a891f8abb61b34b3a53b0f17d309573a4 (diff)
Change menu key bindings to Up and Down and also close it on any mouse
press if opened by key.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/key-bindings.c6
-rw-r--r--usr.bin/tmux/menu.c7
2 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c
index cef809b7780..a22431fdcc1 100644
--- a/usr.bin/tmux/key-bindings.c
+++ b/usr.bin/tmux/key-bindings.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key-bindings.c,v 1.99 2019/09/10 07:50:33 nicm Exp $ */
+/* $OpenBSD: key-bindings.c,v 1.100 2019/09/16 13:27:14 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -328,10 +328,10 @@ key_bindings_init(void)
"bind -n MouseDown3StatusRight display-menu -t= -xM -yS -T \"#[align=centre]#{client_name}\" " DEFAULT_CLIENT_MENU,
"bind -n MouseDown3StatusLeft display-menu -t= -xM -yS -T \"#[align=centre]#{session_name}\" " DEFAULT_SESSION_MENU,
"bind -n MouseDown3Status display-menu -t= -xW -yS -T \"#[align=centre]#{window_index}:#{window_name}\" " DEFAULT_WINDOW_MENU,
- "bind C-m display-menu -xW -yS -T \"#[align=centre]#{window_index}:#{window_name}\" " DEFAULT_WINDOW_MENU,
+ "bind Up display-menu -xW -yS -T \"#[align=centre]#{window_index}:#{window_name}\" " DEFAULT_WINDOW_MENU,
"bind -n MouseDown3Pane if -Ft= '#{||:#{mouse_any_flag},#{pane_in_mode}}' 'select-pane -t=; send-keys -M' {display-menu -t= -xM -yM -T \"#[align=centre]#{pane_index} (#{pane_id})\" " DEFAULT_PANE_MENU "}",
"bind -n M-MouseDown3Pane display-menu -t= -xM -yM -T \"#[align=centre]#{pane_index} (#{pane_id})\" " DEFAULT_PANE_MENU,
- "bind M-m display-menu -xP -yP -T \"#[align=centre]#{pane_index} (#{pane_id})\" " DEFAULT_PANE_MENU,
+ "bind Down display-menu -xP -yP -T \"#[align=centre]#{pane_index} (#{pane_id})\" " DEFAULT_PANE_MENU,
"bind -Tcopy-mode C-Space send -X begin-selection",
"bind -Tcopy-mode C-a send -X start-of-line",
diff --git a/usr.bin/tmux/menu.c b/usr.bin/tmux/menu.c
index 0e4e1f83797..6bb595a4ae7 100644
--- a/usr.bin/tmux/menu.c
+++ b/usr.bin/tmux/menu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: menu.c,v 1.11 2019/07/09 12:44:47 nicm Exp $ */
+/* $OpenBSD: menu.c,v 1.12 2019/09/16 13:27:14 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -185,8 +185,11 @@ menu_key_cb(struct client *c, struct key_event *event)
const char *name;
if (KEYC_IS_MOUSE(event->key)) {
- if (md->flags & MENU_NOMOUSE)
+ if (md->flags & MENU_NOMOUSE) {
+ if (MOUSE_BUTTONS(m->b) != 0)
+ return (1);
return (0);
+ }
if (m->x < md->px ||
m->x > md->px + 4 + menu->width ||
m->y < md->py + 1 ||