helix-mode: introduce HelixRange selection type (no wiring)#1061
Open
kronberger-droid wants to merge 1 commit into
Open
helix-mode: introduce HelixRange selection type (no wiring)#1061kronberger-droid wants to merge 1 commit into
kronberger-droid wants to merge 1 commit into
Conversation
Draft
Contributor
|
This is a pretty small changeset with many tests (thanks). It looks good to me but I'd like to get @schlich's input on it before we land it. Thanks! |
Contributor
|
I'll take a look either tonight or this weekend! |
Contributor
|
@schlich Have you had time to review yet? Sorry to nag. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces
HelixRange, a anchor/head selection range type similar to helix-core, along with aDirectionenum. The type has no callers yet and is gated behind#![allow(dead_code)]until future PRs.Motivation
Part of #960, and follow-up to #1039.
Reedline already has selection state via
Editor::selection_anchorplus the insertion point. That model fits vi's visual mode but doesn't carry two things helix needs:selection_anchorexists only when the user has actively started a selection in vi.Rather than retrofit
selection_anchorto carry direction, this PR adds a helix-local type that encodes both properties.Why direction matters
Behaviors that depend on this:
What's included
HelixRange { anchor, head }with gap-indexing semantics (left-inclusive, right-exclusive, regardless of anchor/head ordering)HelixRangeDirection::{Forward, Backward}enumWhat's deliberately deferred
Selection: reedline is single line.Adaptations from helix-core
RopeSlice&str(future PRs)String, notRopeTests
All 32 tests pass.
The module is
pub(super)and gated behind thehelixfeature flag, thus no behavior change possible.