aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/menu.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index a8bf4ee5be..d965de6019 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -1257,11 +1257,15 @@ void ex_emenu(exarg_T *eap)
/* Found the menu, so execute.
* Use the Insert mode entry when returning to Insert mode. */
- if (restart_edit
- && !current_SID
- ) {
+ if (((State & INSERT) || restart_edit) && !current_SID) {
mode = (char_u *)"Insert";
idx = MENU_INDEX_INSERT;
+ } else if (get_real_state() & VISUAL) {
+ /* Detect real visual mode -- if we are really in visual mode we
+ * don't need to do any guesswork to figure out what the selection
+ * is. Just execute the visual binding for the menu. */
+ mode = (char_u *)"Visual";
+ idx = MENU_INDEX_VISUAL;
} else if (eap->addr_count) {
pos_T tpos;