Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recursive macro crash and empty macro lockout #2902

Merged
merged 1 commit into from
Jun 28, 2022

Conversation

PabloMansanet
Copy link
Contributor

Resolves #2845
Resolves #2846

Took me a bit to sit down and write the fix, but it seems quite straightforward (just shuffling two lines). I added a couple explicative comments, but to summarize:

The existing macro replay protection didn't work, because the guard (an entry in the replaying_macro vector) was cleared at the end of the replay_macro function, but all that function does is queue the keypresses to be executed in a separate context, so recursion could still happen. Now, the guard is cleared only after the entire queue of macro presses has resolved.

As for the lockdown, The problem is that we were marking the macro as being under replay before validating it, which left the register in an invalid unrecoverable state if the macro was invalid.

@archseer archseer merged commit 030de46 into helix-editor:master Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants