From 8a65cd0301e1f768e5e0825daeb6d0185e0e3f23 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 18 Jul 2023 21:39:19 +1000 Subject: [PATCH] emacs: don't move cursor when opening/selecting menu. Having the cursor jump around looks noisy, so try removing it. Signed-off-by: NeilBrown --- mode-emacs.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mode-emacs.c b/mode-emacs.c index 03c5c640..674b7126 100644 --- a/mode-emacs.c +++ b/mode-emacs.c @@ -2538,9 +2538,14 @@ DEF_CMD(emacs_release) DEF_CMD(emacs_menu_open) { /* If there is a menu action here, activate it. */ + /* Don't move the cursor though */ + struct mark *m = mark_new(ci->focus); + int ret; - return call("Move-CursorXY", ci->focus, 0, ci->mark, "menu", - 0, NULL, NULL, ci->x, ci->y); + ret = call("Move-CursorXY", ci->focus, 0, m, "menu", + 0, NULL, NULL, ci->x, ci->y); + mark_free(m); + return ret; } DEF_CMD(emacs_menu_select) @@ -2549,8 +2554,13 @@ DEF_CMD(emacs_menu_select) * so ci->focus is now the menu. We want to activate the entry * under the mouse */ - return call("Move-CursorXY", ci->focus, 0, ci->mark, "activate", - 0, NULL, NULL, ci->x, ci->y); + struct mark *m = mark_new(ci->focus); + int ret; + + ret = call("Move-CursorXY", ci->focus, 0, m, "activate", + 0, NULL, NULL, ci->x, ci->y); + mark_free(m); + return ret; } DEF_CMD(emacs_motion) -- 2.39.5