input: prevent 'macro_length' from underflowing when hammering M-:
Normally, when recording a macro, users will make their keystrokes slowly and carefully, and will most likely wait to see the effect of the previous keystroke before making the next. So, the chances of two `recordmacro` keystrokes coming in in quick succession is normally nil. The 'macro_length' variable just needs a guard to prevent it from underflowing when someone is hammering the keys. This fixes https://savannah.gnu.org/bugs/?65394 in a better way.
This commit is contained in:
parent
9ae84071eb
commit
3fb8efc8f2
@ -91,6 +91,7 @@ void add_to_macrobuffer(int code)
|
|||||||
/* Remove the last key code plus any leading Esc codes from macro buffer. */
|
/* Remove the last key code plus any leading Esc codes from macro buffer. */
|
||||||
void snip_last_keystroke(void)
|
void snip_last_keystroke(void)
|
||||||
{
|
{
|
||||||
|
if (macro_length > 0)
|
||||||
macro_length--;
|
macro_length--;
|
||||||
while (macro_length > 0 && macro_buffer[macro_length - 1] == '\x1b')
|
while (macro_length > 0 && macro_buffer[macro_length - 1] == '\x1b')
|
||||||
macro_length--;
|
macro_length--;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user