aboutsummaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-10-23 03:09:40 +0000
committerBlaž Hrastnik2020-12-03 04:10:35 +0000
commitf5981f72c256a834845aad0c2947a4a20fa84d1b (patch)
tree0e0ec51469ccfe3c21967192287997af2644c6ee /helix-core
parent55fa86248c77a01900379ec5bca668978fd5c0d3 (diff)
Introduce Selection::point.
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/selection.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index 13c820f1..9413fead 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -179,6 +179,11 @@ impl Selection {
}
}
+ /// Constructs a selection holding a single cursor.
+ pub fn point(pos: usize) -> Self {
+ Self::single(pos, pos)
+ }
+
#[must_use]
pub fn new(ranges: SmallVec<[Range; 1]>, primary_index: usize) -> Self {
fn normalize(mut ranges: SmallVec<[Range; 1]>, mut primary_index: usize) -> Selection {