patch 8.2.4711: when 'insermode' is set :edit from <Cmd> mapping misbehaves
Problem: When 'insermode' is set :edit from <Cmd> mapping misbehaves.
Solution: Don't set "need_start_insertmode" when already in Insert mode.
(closes #10116)
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 8cdac4b..50829be 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -3182,7 +3182,7 @@
redraw_curbuf_later(NOT_VALID); // redraw this buffer later
}
- if (p_im)
+ if (p_im && (State & INSERT) == 0)
need_start_insertmode = TRUE;
#ifdef FEAT_AUTOCHDIR