summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-04-07 13:58:04 +0100
committerBram Moolenaar <Bram@vim.org>2022-04-07 13:58:04 +0100
commit6d4e725a3447af6f69305fdc9f1e1ff8d82e3863 (patch)
tree2b8acbed1a0774ac7def27ea696f7ad59e93a6d7 /src/getchar.c
parentf26c16144ddb27642c09f2cf5271afd163b36306 (diff)
patch 8.2.4705: jump list marker disappearsv8.2.4705
Problem: Jump list marker disappears. Solution: Reset reg_executing later. (closes #10111, closes #10100)
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/getchar.c b/src/getchar.c
index b81f64a65c..29ad56e6a1 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1421,7 +1421,7 @@ static int old_mouse_row; // mouse_row related to old_char
static int old_mouse_col; // mouse_col related to old_char
static int old_KeyStuffed; // whether old_char was stuffed
-static int can_get_old_char()
+static int can_get_old_char(void)
{
// If the old character was not stuffed and characters have been added to
// the stuff buffer, need to first get the stuffed characters instead.
@@ -2950,7 +2950,7 @@ handle_mapping(
/*
* unget one character (can only be done once!)
- * If the character was stuffed, vgetc() will get it next time it was called.
+ * If the character was stuffed, vgetc() will get it next time it is called.
* Otherwise vgetc() will only get it when the stuff buffer is empty.
*/
void
@@ -2964,6 +2964,27 @@ vungetc(int c)
}
/*
+ * When peeking and not getting a character, reg_executing cannot be cleared
+ * yet, so set a flag to clear it later.
+ */
+ static void
+check_end_reg_executing(int advance)
+{
+ if (reg_executing != 0 && (typebuf.tb_maplen == 0
+ || pending_end_reg_executing))
+ {
+ if (advance)
+ {
+ reg_executing = 0;
+ pending_end_reg_executing = FALSE;
+ }
+ else
+ pending_end_reg_executing = TRUE;
+ }
+
+}
+
+/*
* Get a byte:
* 1. from the stuffbuffer
* This is used for abbreviated commands like "D" -> "d$".
@@ -3026,8 +3047,7 @@ vgetorpeek(int advance)
init_typebuf();
start_stuff();
- if (advance && typebuf.tb_maplen == 0)
- reg_executing = 0;
+ check_end_reg_executing(advance);
do
{
/*
@@ -3068,6 +3088,7 @@ vgetorpeek(int advance)
#ifdef FEAT_CMDL_INFO
int showcmd_idx;
#endif
+ check_end_reg_executing(advance);
/*
* ui_breakcheck() is slow, don't use it too often when
* inside a mapping. But call it each time for typed