commit 191cf671be155fb425b31855cc0044636f75470a
parent 3098315e05e343ecf3c5d6f5fa65ff366d0bd1d6
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sat, 2 Mar 2024 16:49:27 +0100
input: store keystroke in macro buffer only when about to interpret it
When the keystroke after the keystroke bound to `recordmacro` arrived
so quickly that the two got stored together in nano's keystroke buffer,
the main loop had not yet interpreted the `recordmacro` command and had
thus not yet set 'recording' to true, meaning that that second keystroke
would not get recorded.
Nano should record keystrokes into the macro buffer when fetching them
from its own keystroke buffer, not when fetching them from ncurses.
This fixes https://savannah.gnu.org/bugs/?65394.
The issue was reported by `correctmost`.
Bug existed since version 2.9.0, since macros were introduced.
Diffstat:
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/winio.c b/src/winio.c
@@ -290,10 +290,6 @@ void read_keys_from(WINDOW *frame)
napms(20);
while (TRUE) {
-#ifndef NANO_TINY
- if (recording)
- add_to_macrobuffer(input);
-#endif
input = wgetch(frame);
/* If there aren't any more characters, stop reading. */
@@ -1373,6 +1369,11 @@ int get_kbinput(WINDOW *frame, bool showcursor)
while (kbinput == ERR)
kbinput = parse_kbinput(frame);
+#ifndef NANO_TINY
+ if (recording)
+ add_to_macrobuffer(kbinput);
+#endif
+
/* If we read from the edit window, blank the status bar if needed. */
if (frame == midwin)
check_statusblank();