Skip to content

Conversation

@nriley
Copy link
Collaborator

@nriley nriley commented Sep 7, 2025

Applies when:

  • there is text on the line after the inserted snippet
  • the first stop in the snippet is on the last (or only) line

Also documents an assumption in move_to_correct_column that caused the incorrect behavior.

Per discussion on Slack, we may want to change the behavior of move_to_correct_column to not go to the end of the line, but this involves different tradeoffs that should be discussed further.

Applies when:

- there is text on the line after the inserted snippet
- the first stop in the snippet is on the last (or only) line

Also documents an assumption in move_to_correct_column that caused the
incorrect behavior.
)

RE_STOP = re.compile(r"\$(\d+|\w+)|\$\{(\d+|\w+)\}|\$\{(\d+|\w+):(.+)\}")
RE_STOP = re.compile(r"\\?(?:\$(\d+|\w+)|\$\{(\d+|\w+)\}|\$\{(\d+|\w+):(.+)\})")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now complicated enough that it probably warrants a comment breaking down the different parts.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! Commenting the regex made me realize I was doing unnecessary work when matching a \$.

Don't bother to match anything further after we've found \$.
@nriley nriley merged commit 0b109fe into talonhub:main Sep 14, 2025
2 checks passed
@nriley nriley deleted the first-stop branch September 14, 2025 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants