Skip to content
New issue

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

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

Already on GitHub? # to your account

Vertical Selection #462

Merged
merged 3 commits into from
Aug 5, 2021
Merged

Conversation

luctius
Copy link
Contributor

@luctius luctius commented Jul 17, 2021

My attempt to add #457.

This does not 'undo' a selection when moving into the opposite direction; instead it enlarges it. Not sure what the behaviour should be.

helix-term/src/commands.rs Outdated Show resolved Hide resolved
let mut ranges: SmallVec<_> = old_selection.ranges().into();
for r in old_selection.iter() {
ranges.push(Range::point(
movement::move_vertically(text, *r, Direction::Backward, count, Movement::Extend).head,
Copy link
Member

Choose a reason for hiding this comment

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

Okay one last thing: The count should duplicate the selection on n lines, for example 3C should duplicate it on all three lines above the current line. move_vertically's count will instead give you a single range that's n lines above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good point; I forgot about that...

@archseer archseer force-pushed the vertical_selection branch 2 times, most recently from ef6e500 to 995f25c Compare August 5, 2021 07:51
@archseer archseer force-pushed the vertical_selection branch from 995f25c to 7918db0 Compare August 5, 2021 07:51
@archseer archseer merged commit 5342f97 into helix-editor:master Aug 5, 2021
@archseer
Copy link
Member

archseer commented Aug 5, 2021

Ended up reworking this myself :) Thanks for the PR!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants