From f5981f72c256a834845aad0c2947a4a20fa84d1b Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Fri, 23 Oct 2020 12:09:40 +0900 Subject: Introduce Selection::point. --- helix-core/src/selection.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'helix-core') 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 { -- cgit v1.2.3-70-g09d2