This commit is contained in:
alice pellerin
2026-03-18 04:05:43 -05:00
parent 98f4c56852
commit 11075723d8
7 changed files with 87 additions and 5 deletions
+11 -1
View File
@@ -1,4 +1,6 @@
#[derive(Debug, Default, PartialEq, Eq)]
use std::ops::RangeInclusive;
#[derive(Clone, Copy, Default, PartialEq, Eq)]
pub struct Cursor {
pub head: usize,
pub tail: usize
@@ -39,6 +41,14 @@ impl Cursor {
self.tail = self.tail.clamp(scroll_position, max_row);
}
pub const fn range(&self) -> RangeInclusive<usize> {
if self.head < self.tail {
self.head..=self.tail
} else {
self.tail..=self.head
}
}
pub fn move_to_next_word(&mut self, max: usize) {
if self.head == max { return }