summaryrefslogtreecommitdiff
path: root/helix-core
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-07-30 07:50:38 +0000
committerBlaž Hrastnik2021-07-30 07:52:14 +0000
commit62eb8c6b407c61d21dbee83c4b4e78c4e6cb87c3 (patch)
treee8487e4a2c0cb330a6740eff873c6b0139a634ee /helix-core
parent6bb744aeacb56846c3bb50338e2bb81328e4e396 (diff)
mouse: Remove verify_screen_coords, refactor primary selection modification
Diffstat (limited to 'helix-core')
-rw-r--r--helix-core/src/selection.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-core/src/selection.rs b/helix-core/src/selection.rs
index 14c54295..a3ea2ed4 100644
--- a/helix-core/src/selection.rs
+++ b/helix-core/src/selection.rs
@@ -329,11 +329,18 @@ pub struct Selection {
impl Selection {
// eq
+ #[inline]
#[must_use]
pub fn primary(&self) -> Range {
self.ranges[self.primary_index]
}
+ #[inline]
+ #[must_use]
+ pub fn primary_mut(&mut self) -> &mut Range {
+ &mut self.ranges[self.primary_index]
+ }
+
/// Ensure selection containing only the primary selection.
pub fn into_single(self) -> Self {
if self.ranges.len() == 1 {