diff options
Diffstat (limited to 'src/getchar.c')
-rw-r--r-- | src/getchar.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/getchar.c b/src/getchar.c index 3b9d42014..88e724ff3 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -4335,11 +4335,26 @@ eval_map_expr(str) char_u *res; char_u *p; char_u *save_cmd; + pos_T save_cursor; save_cmd = save_cmdline_alloc(); if (save_cmd == NULL) return NULL; + + /* Forbid changing text or using ":normal" to avoid most of the bad side + * effects. Also restore the cursor position. */ + ++textlock; +#ifdef FEAT_EX_EXTRA + ++ex_normal_lock; +#endif + save_cursor = curwin->w_cursor; p = eval_to_string(str, NULL, FALSE); + --textlock; +#ifdef FEAT_EX_EXTRA + --ex_normal_lock; +#endif + curwin->w_cursor = save_cursor; + restore_cmdline_alloc(save_cmd); if (p == NULL) return NULL; |