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

Recursive macro stuck in loop / stack overflow #2249

Closed
Zoybean opened this issue Apr 24, 2022 · 2 comments
Closed

Recursive macro stuck in loop / stack overflow #2249

Zoybean opened this issue Apr 24, 2022 · 2 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@Zoybean
Copy link
Contributor

Zoybean commented Apr 24, 2022

Summary

Being used to vim keybindings, I accidentally pressed q to end a recording instead of Q. Doing this a second time after finishing recording the first macro resulted in the program freezing, presumably replaying the now-recursive macro.

The first time this occurred, the program remained frozen for several minutes until I killed it with kill <PID>. Attempting to reproduce the issue, I made a smaller macro, which ended up immediately overflowing the stack.

Reproduction Steps

I tried this:

  1. hx
  2. QqQq

I expected this to happen:

  • Helix prevents me from recording a recursive macro

Instead, this happened:

  • Helix crashes due to stack overflow

Helix log

No response

Platform

Linux (Ubuntu on WSL)

Terminal Emulator

Windows Terminal Version: 1.12.10982.0

Helix Version

22.03-121-g6de2e763

@Zoybean Zoybean added the C-bug Category: This is a bug label Apr 24, 2022
@Zoybean Zoybean changed the title Recursive macro stuck in loop Recursive macro stuck in loop / stack overflow Apr 24, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Apr 24, 2022
@gavynriebau
Copy link
Contributor

gavynriebau commented Jun 2, 2022

I encountered the same bug and have raised a PR with a fix in #2647.

There are some additional scenarios that could also trigger the crash, for example:

"aQ"bqQ"bQ"aqQ"aq

The above sequence can be described as

  1. start recording into register 'a'
  2. replay register 'b'
  3. end recording into register 'a'
  4. start recording into register 'b'
  5. replay register 'a'
  6. stop recording into register 'b'
  7. replay register 'a'

Sequences of commands like the above generated an infinite loop because one macro would replay a second macro which would attempt to replay the first macro...

@archseer
Copy link
Member

archseer commented Jun 5, 2022

Closed by #2647

@archseer archseer closed this as completed Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

4 participants