add G motion and up/down/left/right
This commit is contained in:
+3
-4
@@ -1,5 +1,3 @@
|
||||
use crate::BYTES_PER_LINE;
|
||||
|
||||
#[derive(Debug, Default, PartialEq, Eq)]
|
||||
pub struct Cursor {
|
||||
pub head: usize,
|
||||
@@ -33,8 +31,9 @@ impl Cursor {
|
||||
self.tail = self.head;
|
||||
}
|
||||
|
||||
pub fn clamp(&mut self, scroll_position: usize, window_rows: usize) {
|
||||
let max_row = scroll_position + window_rows * BYTES_PER_LINE - 1;
|
||||
// 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);
|
||||
|
||||
Reference in New Issue
Block a user