aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/selection.rs
diff options
context:
space:
mode:
authorPabloMansanet2021-06-11 12:57:07 +0000
committerGitHub2021-06-11 12:57:07 +0000
commit86af55c379c531df2d5dbc72841e28a10fc7938e (patch)
treed2946657e2ca0102c7ddf291b0ffb9819ab001d9 /helix-core/src/selection.rs
parent0c2b99327a60d478ff6a4e4a2a15f69e61857569 (diff)
Movement fixes, refactor and unit test suite (#217)
* Add convenience/clarity wrapper for Range initialization * Test horizontal moves * Add column jumping tests * Add failing movement conditions for multi-word moves * Refactor skip_over_next * Add complex forward movement unit tests * Add strict whitespace checks and edge case tests * Restore formatting * Remove unused function * Add empty test case for deletion and fix nth_prev_word_boundary * Add tests for backward motion * Refactor word movement * Address review comments and finish refactoring backwards move * Finish unit test suite * Fmt pass * Fix lint erors * Clean up diff restoring bad 'cargo fmt' actions * Simplify movement closures (thanks Pickfire) * Fmt pass * Replace index-based movement with iterator based movement, ensuring that each move incurs a single call to the RopeSlice API * Break down tuple function * Extract common logic to all movement functions * Split iterator helpers away into their own module * WIP reducing clones * Operate on spans * WIP simplifying iterators * Simplify motion helpers * Fix iterator * Fix all unit tests * Refactor and simplify * Simplify fold
Diffstat (limited to 'helix-core/src/selection.rs')
-rw-r--r--helix-core/src/selection.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index 7dafc97a..e452c2e2 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -35,6 +35,10 @@ impl Range {
}
}
+ pub fn point(head: usize) -> Self {
+ Self::new(head, head)
+ }
+
/// Start of the range.
#[inline]
#[must_use]