fix scrolling and clamping

This commit is contained in:
alice pellerin
2026-04-29 17:41:05 -05:00
parent 162046d13e
commit 15132d44af
8 changed files with 136 additions and 131 deletions
+3 -6
View File
@@ -59,12 +59,9 @@ impl Cursor {
swap(&mut self.head, &mut self.tail);
}
// TODO: in visual mode, should only clamp head
pub fn clamp(&mut self, scroll_position: usize, screen_size: usize) {
let max_row = scroll_position + screen_size - 1;
self.head = self.head.clamp(scroll_position, max_row);
self.tail = self.tail.clamp(scroll_position, max_row);
pub fn clamp(&mut self, min: usize, max: usize) {
self.head = self.head.clamp(min, max);
self.tail = self.tail.clamp(min, max);
}
pub fn combine_with(&mut self, other: Self) {