comparison src/getchar.c @ 18689:8cc12c8d7842 v8.1.2336

patch 8.1.2336: when an expr mapping moves the cursor it is not restored Commit: https://github.com/vim/vim/commit/4ebe0e62d097d68c5312f9c32714fb41a4c947a3 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Nov 22 20:55:40 2019 +0100 patch 8.1.2336: when an expr mapping moves the cursor it is not restored Problem: When an expr mapping moves the cursor it is not restored. Solution: Position the cursor after an expr mapping. (closes https://github.com/vim/vim/issues/5256)
author Bram Moolenaar <Bram@vim.org>
date Fri, 22 Nov 2019 21:00:04 +0100
parents 5ed740336224
children 14d2a210fab1
comparison
equal deleted inserted replaced
18688:b291f5642a2c 18689:8cc12c8d7842
2592 */ 2592 */
2593 if (mp->m_expr) 2593 if (mp->m_expr)
2594 { 2594 {
2595 int save_vgetc_busy = vgetc_busy; 2595 int save_vgetc_busy = vgetc_busy;
2596 int save_may_garbage_collect = may_garbage_collect; 2596 int save_may_garbage_collect = may_garbage_collect;
2597 int was_screen_col = screen_cur_col;
2598 int was_screen_row = screen_cur_row;
2597 2599
2598 vgetc_busy = 0; 2600 vgetc_busy = 0;
2599 may_garbage_collect = FALSE; 2601 may_garbage_collect = FALSE;
2600 2602
2601 save_m_keys = vim_strsave(mp->m_keys); 2603 save_m_keys = vim_strsave(mp->m_keys);
2602 save_m_str = vim_strsave(mp->m_str); 2604 save_m_str = vim_strsave(mp->m_str);
2603 map_str = eval_map_expr(save_m_str, NUL); 2605 map_str = eval_map_expr(save_m_str, NUL);
2606
2607 // The mapping may do anything, but we expect it to take care of
2608 // redrawing. Do put the cursor back where it was.
2609 windgoto(was_screen_row, was_screen_col);
2610 out_flush();
2604 2611
2605 vgetc_busy = save_vgetc_busy; 2612 vgetc_busy = save_vgetc_busy;
2606 may_garbage_collect = save_may_garbage_collect; 2613 may_garbage_collect = save_may_garbage_collect;
2607 } 2614 }
2608 else 2615 else