comparison src/getchar.c @ 28395:a0cd2b7a78ef v8.2.4722

patch 8.2.4722: ending recording with mapping records too much Commit: https://github.com/vim/vim/commit/81b46a6ccd818609e1ca8cd410e26a58428c30ba Author: zeertzjq <zeertzjq@outlook.com> Date: Sat Apr 9 17:58:49 2022 +0100 patch 8.2.4722: ending recording with mapping records too much Problem: When a recording is ended with a mapped key that key is also recorded. Solution: Remember the previous last_recorded_len. (closes #10122)
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Apr 2022 19:00:02 +0200
parents 390dfc3e409b
children 4dcccb2673fe
comparison
equal deleted inserted replaced
28394:c7353962787c 28395:a0cd2b7a78ef
1703 mouse_row = old_mouse_row; 1703 mouse_row = old_mouse_row;
1704 mouse_col = old_mouse_col; 1704 mouse_col = old_mouse_col;
1705 } 1705 }
1706 else 1706 else
1707 { 1707 {
1708 // number of characters recorded from the last vgetc() call
1709 static int last_vgetc_recorded_len = 0;
1710
1708 mod_mask = 0; 1711 mod_mask = 0;
1709 vgetc_mod_mask = 0; 1712 vgetc_mod_mask = 0;
1710 vgetc_char = 0; 1713 vgetc_char = 0;
1711 last_recorded_len = 0; 1714
1715 // last_recorded_len can be larger than last_vgetc_recorded_len
1716 // if peeking records more
1717 last_recorded_len -= last_vgetc_recorded_len;
1712 1718
1713 for (;;) // this is done twice if there are modifiers 1719 for (;;) // this is done twice if there are modifiers
1714 { 1720 {
1715 int did_inc = FALSE; 1721 int did_inc = FALSE;
1716 1722
1908 vgetc_char = c; 1914 vgetc_char = c;
1909 } 1915 }
1910 1916
1911 break; 1917 break;
1912 } 1918 }
1919
1920 last_vgetc_recorded_len = last_recorded_len;
1913 } 1921 }
1914 1922
1915 #ifdef FEAT_EVAL 1923 #ifdef FEAT_EVAL
1916 /* 1924 /*
1917 * In the main loop "may_garbage_collect" can be set to do garbage 1925 * In the main loop "may_garbage_collect" can be set to do garbage