diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-21 10:40:07 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-21 10:40:07 +0100 |
commit | 8d69637133e17370491b83da8657a15b991c2f76 (patch) | |
tree | 6fc2da44d8f79deccf2616ab2082c2c9de393b5b | |
parent | a7704226a26b95b15bf87d3a3a5128e23e4aaa06 (diff) | |
download | vim-git-8d69637133e17370491b83da8657a15b991c2f76.tar.gz |
patch 9.0.0234: cannot make difference between :normal end and argument charv9.0.0234
Problem: Cannot make difference between the end of :normal and a character
in its argument.
Solution: Add the "typebuf_was_empty" flag. (closes #10950)
-rw-r--r-- | src/getchar.c | 7 | ||||
-rw-r--r-- | src/globals.h | 4 | ||||
-rw-r--r-- | src/normal.c | 6 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 16 insertions, 3 deletions
diff --git a/src/getchar.c b/src/getchar.c index c7601ef61..4134eb9a9 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -3056,7 +3056,10 @@ vgetorpeek(int advance) ++vgetc_busy; if (advance) + { KeyStuffed = FALSE; + typebuf_was_empty = FALSE; + } init_typebuf(); start_stuff(); @@ -3361,6 +3364,10 @@ vgetorpeek(int advance) #ifdef FEAT_CMDWIN tc = c; #endif + // set a flag to indicate this wasn't a normal char + if (advance) + typebuf_was_empty = TRUE; + // return from main_loop() if (pending_exmode_active) exmode_active = EXMODE_NORMAL; diff --git a/src/globals.h b/src/globals.h index 21fabdbb5..99ecefbdd 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1206,6 +1206,10 @@ EXTERN typebuf_T typebuf // typeahead buffer = {NULL, NULL, 0, 0, 0, 0, 0, 0, 0} #endif ; +// Flag used to indicate that vgetorpeek() returned a char like Esc when the +// :normal argument was exhausted. +EXTERN int typebuf_was_empty INIT(= FALSE); + EXTERN int ex_normal_busy INIT(= 0); // recursiveness of ex_normal() #ifdef FEAT_EVAL EXTERN int in_feedkeys INIT(= 0); // ex_normal_busy set in feedkeys() diff --git a/src/normal.c b/src/normal.c index b1335a037..0ce0d4e32 100644 --- a/src/normal.c +++ b/src/normal.c @@ -6808,11 +6808,11 @@ nv_esc(cmdarg_T *cap) #endif } #ifdef FEAT_CMDWIN - else if (cmdwin_type != 0 && ex_normal_busy) + else if (cmdwin_type != 0 && ex_normal_busy && typebuf_was_empty) { // When :normal runs out of characters while in the command line window - // vgetorpeek() will return ESC. Exit the cmdline window to break the - // loop. + // vgetorpeek() will repeatedly return ESC. Exit the cmdline window to + // break the loop. cmdwin_result = K_IGNORE; return; } diff --git a/src/version.c b/src/version.c index 92b55eecb..07b571d8f 100644 --- a/src/version.c +++ b/src/version.c @@ -732,6 +732,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 234, +/**/ 233, /**/ 232, |