summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2020-03-20 17:26:14 +0000
committernicm <nicm>2020-03-20 17:26:14 +0000
commit7bbca4939537bcb12d9488cbd0e88fb8bbb5dbc3 (patch)
treeece4724fea6402215c07b19a53adb1819f306d9b
parenta3ff5a9e258e84b76af53a136bf8473ae67a0bcd (diff)
Fix positioning of menu in choose modes and a couple of keys in tree mode.
-rw-r--r--menu.c4
-rw-r--r--mode-tree.c4
-rw-r--r--window-tree.c4
3 files changed, 10 insertions, 2 deletions
diff --git a/menu.c b/menu.c
index 049c4836..f70b1d18 100644
--- a/menu.c
+++ b/menu.c
@@ -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/mode-tree.c b/mode-tree.c
index b9fa5f65..843a74bc 100644
--- a/mode-tree.c
+++ b/mode-tree.c
@@ -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/window-tree.c b/window-tree.c
index d163dd9e..4d5b4a1e 100644
--- a/window-tree.c
+++ b/window-tree.c
@@ -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 },