diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-11-22 20:55:40 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-11-22 20:55:40 +0100 |
commit | 4ebe0e62d097d68c5312f9c32714fb41a4c947a3 (patch) | |
tree | a5ab5da2bf923c76de42263032609ac02a81c0ea /src/getchar.c | |
parent | 2118a302957dea352174722bf355376901f49b9b (diff) | |
download | vim-git-4ebe0e62d097d68c5312f9c32714fb41a4c947a3.tar.gz |
patch 8.1.2336: when an expr mapping moves the cursor it is not restoredv8.1.2336
Problem: When an expr mapping moves the cursor it is not restored.
Solution: Position the cursor after an expr mapping. (closes #5256)
Diffstat (limited to 'src/getchar.c')
-rw-r--r-- | src/getchar.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/getchar.c b/src/getchar.c index 475ee7efe..b086126d9 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2594,6 +2594,8 @@ handle_mapping( { int save_vgetc_busy = vgetc_busy; int save_may_garbage_collect = may_garbage_collect; + int was_screen_col = screen_cur_col; + int was_screen_row = screen_cur_row; vgetc_busy = 0; may_garbage_collect = FALSE; @@ -2602,6 +2604,11 @@ handle_mapping( save_m_str = vim_strsave(mp->m_str); map_str = eval_map_expr(save_m_str, NUL); + // The mapping may do anything, but we expect it to take care of + // redrawing. Do put the cursor back where it was. + windgoto(was_screen_row, was_screen_col); + out_flush(); + vgetc_busy = save_vgetc_busy; may_garbage_collect = save_may_garbage_collect; } |