]> git.neil.brown.name Git - edlib.git/commitdiff
emacs: don't move cursor when opening/selecting menu.
authorNeilBrown <neil@brown.name>
Tue, 18 Jul 2023 11:39:19 +0000 (21:39 +1000)
committerNeilBrown <neil@brown.name>
Tue, 18 Jul 2023 11:51:36 +0000 (21:51 +1000)
Having the cursor jump around looks noisy, so try removing it.

Signed-off-by: NeilBrown <neil@brown.name>
mode-emacs.c

index 03c5c6404d6d894ae5eabe03c831095c058160bf..674b71264f36995d375ed7be71f8530c6ca76f65 100644 (file)
@@ -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)