summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-display-menu.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-03-28 09:55:30 +0000
committernicm <nicm@openbsd.org>2020-03-28 09:55:30 +0000
commit386b15893c52318a91656014c2ae477387271b36 (patch)
tree62ba5d85c2d5f7c320f9606e3f6e531ca32f6688 /usr.bin/tmux/cmd-display-menu.c
parentMake two -E only close popup automatically if the command exited with 0. (diff)
downloadwireguard-openbsd-386b15893c52318a91656014c2ae477387271b36.tar.xz
wireguard-openbsd-386b15893c52318a91656014c2ae477387271b36.zip
Change default position for menu and popup to centre rather than top left.
Diffstat (limited to 'usr.bin/tmux/cmd-display-menu.c')
-rw-r--r--usr.bin/tmux/cmd-display-menu.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-display-menu.c b/usr.bin/tmux/cmd-display-menu.c
index c4e6b3c56b0..bbada1321ce 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.9 2020/03/28 09:51:12 nicm Exp $ */
+/* $OpenBSD: cmd-display-menu.c,v 1.10 2020/03/28 09:55:30 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -73,12 +73,10 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
u_int ox, oy, sx, sy;
xp = args_get(args, 'x');
- if (xp == NULL)
- *px = 0;
+ if (xp == NULL || strcmp(xp, "C") == 0)
+ *px = (c->tty.sx - 1) / 2 - w / 2;
else if (strcmp(xp, "R") == 0)
*px = c->tty.sx - 1;
- else if (strcmp(xp, "C") == 0)
- *px = (c->tty.sx - 1) / 2 - w / 2;
else if (strcmp(xp, "P") == 0) {
tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);
if (wp->xoff >= ox)
@@ -111,9 +109,7 @@ cmd_display_menu_get_position(struct client *c, struct cmdq_item *item,
*px = c->tty.sx - w;
yp = args_get(args, 'y');
- if (yp == NULL)
- *py = 0;
- else if (strcmp(yp, "C") == 0)
+ if (yp == NULL || strcmp(yp, "C") == 0)
*py = (c->tty.sy - 1) / 2 + h / 2;
else if (strcmp(yp, "P") == 0) {
tty_window_offset(&c->tty, &ox, &oy, &sx, &sy);