summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-03-20 17:26:14 +0000
committernicm <nicm@openbsd.org>2020-03-20 17:26:14 +0000
commite38aac43d83f26bc37265edb5bfb6bc6f0252d76 (patch)
tree98d0b68cb0196395948914e68026eee1393b7f84
parentfutex(2): futex_wait(): ensure timeout is set when calling rwsleep_nsec(9) (diff)
downloadwireguard-openbsd-e38aac43d83f26bc37265edb5bfb6bc6f0252d76.tar.xz
wireguard-openbsd-e38aac43d83f26bc37265edb5bfb6bc6f0252d76.zip
Fix positioning of menu in choose modes and a couple of keys in tree mode.
-rw-r--r--usr.bin/tmux/menu.c6
-rw-r--r--usr.bin/tmux/mode-tree.c6
-rw-r--r--usr.bin/tmux/window-tree.c6
3 files changed, 13 insertions, 5 deletions
diff --git a/usr.bin/tmux/menu.c b/usr.bin/tmux/menu.c
index 1254d2c781d..e7ab42fba81 100644
--- a/usr.bin/tmux/menu.c
+++ b/usr.bin/tmux/menu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: menu.c,v 1.13 2020/03/19 14:23:58 nicm Exp $ */
+/* $OpenBSD: menu.c,v 1.14 2020/03/20 17:26:14 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -295,6 +295,10 @@ menu_display(struct menu *menu, int flags, struct cmdq_item *item, u_int px,
if (c->tty.sx < menu->width + 4 || c->tty.sy < menu->count + 2)
return (-1);
+ if (px + menu->width + 4 > c->tty.sx)
+ px = c->tty.sx - menu->width - 4;
+ if (py + menu->count + 2 > c->tty.sy)
+ py = c->tty.sy - menu->count - 2;
md = xcalloc(1, sizeof *md);
md->item = item;
diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c
index 60017a7f69e..bbc55d13b73 100644
--- a/usr.bin/tmux/mode-tree.c
+++ b/usr.bin/tmux/mode-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-tree.c,v 1.37 2019/12/12 15:03:13 nicm Exp $ */
+/* $OpenBSD: mode-tree.c,v 1.38 2020/03/20 17:26:14 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -847,6 +847,10 @@ mode_tree_display_menu(struct mode_tree_data *mtd, struct client *c, u_int x,
mtm->itemdata = mti->itemdata;
mtd->references++;
+ if (x >= (menu->width + 4) / 2)
+ x -= (menu->width + 4) / 2;
+ else
+ x = 0;
if (menu_display(menu, 0, NULL, x, y, c, NULL, mode_tree_menu_callback,
mtm) != 0)
menu_free(menu);
diff --git a/usr.bin/tmux/window-tree.c b/usr.bin/tmux/window-tree.c
index f4f80e59d74..f7af6fa8133 100644
--- a/usr.bin/tmux/window-tree.c
+++ b/usr.bin/tmux/window-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-tree.c,v 1.44 2020/01/08 06:38:55 nicm Exp $ */
+/* $OpenBSD: window-tree.c,v 1.45 2020/03/20 17:26:14 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -54,8 +54,8 @@ static void window_tree_key(struct window_mode_entry *,
"}"
static const struct menu_item window_tree_menu_items[] = {
- { "Select", 'E', NULL },
- { "Expand", 'R', NULL },
+ { "Select", '\r', NULL },
+ { "Expand", KEYC_RIGHT, NULL },
{ "", KEYC_NONE, NULL },
{ "Tag", 't', NULL },
{ "Tag All", '\024', NULL },