On Di, 08 Okt 2013, Urtica dioica wrote:
> Open a blank Vim (I'm using 7.4.52), and type this:
>
> 3graqqY:s/a/b/g|s/b/c/g<CR>pq@q
>
> (Since there are 3 "a"s, and the 'report' default is 2, both :s commands
> report the number of changes, which triggers a Press ENTER prompt. But the
> bug applies to any Press ENTER prompt.)
>
> When "p" is run straight after the prompt, it runs once (as it should). In
> the "q register however, the "p" is recorded twice. You can confirm this with
> ":display q". When you run "@q", "p" runs both times, as it's recorded in the
> macro.
>
> The same problem exists when recording keystrokes to a file with "vim -w".
>
> If you actually hit Enter to dismiss the prompt, that will also be recorded.
> If you put it in a macro, for instance, the extra Enter will run and try to
> move the cursor.
Hmm, the problem is, that wait_return pushes the entered character back
into the input queue.
I think, this patches fixes it.
diff --git a/src/message.c b/src/message.c
--- a/src/message.c
+++ b/src/message.c
@@ -887,6 +887,7 @@
int oldState;
int tmpState;
int had_got_int;
+ int had_Recording = Recording;
if (redraw == TRUE)
must_redraw = CLEAR;
@@ -957,11 +958,16 @@
* typeahead buffer. */
++no_mapping;
++allow_keys;
+ /* temporarily disable Recording. If Recording is active, the char
+ * will be recorded later, since the character will be added to the
+ * typebuf after the loop */
+ Recording = FALSE;
c = safe_vgetc();
if (had_got_int && !global_busy)
got_int = FALSE;
--no_mapping;
--allow_keys;
+ Recording = had_Recording;
#ifdef FEAT_CLIPBOARD
/* Strange way to allow copying (yanking) a modeless selection at
regards,
Christian
--
Das Zuhause ist keineswegs der einzige zivilisierte Ort in einer
abenteuerlichen Welt, sondern der einzige unzivilisierte in einer Welt
der Zwänge und Pflichten.
-- Gilbert Keith Chesterton
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.