Skip to content

Add a check to prevent re-selecting same range - #2760

Merged
the-mikedavis merged 2 commits into
helix-editor:masterfrom
sohnryang:master
Jun 14, 2022
Merged

Add a check to prevent re-selecting same range#2760
the-mikedavis merged 2 commits into
helix-editor:masterfrom
sohnryang:master

Conversation

@sohnryang

Copy link
Copy Markdown
Contributor

This fixes #2714.

@the-mikedavis

Copy link
Copy Markdown
Member

I gave this a try and it looks like there's an edge-case when we expand to the root node: we hit A-o until we are at the root node and then A-i doesn't change the selection.

Instead, I think we can compare the selection returned by the object::expand_selection line and current_selection. We should only push current_selection and call doc.set_selection if the current_selection isn't equal to the expanded selection

@sohnryang

Copy link
Copy Markdown
Contributor Author

Fixed!

@the-mikedavis the-mikedavis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works great, thanks for the fix!

@the-mikedavis
the-mikedavis merged commit 3bd5545 into helix-editor:master Jun 14, 2022
lazytanuki pushed a commit to lazytanuki/helix that referenced this pull request Jun 21, 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

Development

Successfully merging this pull request may close these issues.

Hitting A-o stacks up "deselects" even though there is nothing more to select.

2 participants