Move to start/end of editor line
This commit is contained in:
parent
ba35a606a8
commit
4bf6d80988
2 changed files with 26 additions and 0 deletions
|
|
@ -234,6 +234,20 @@ impl InnerEditorState {
|
|||
}
|
||||
}
|
||||
|
||||
fn move_cursor_to_start_of_line(&mut self, frame: &mut Frame) {
|
||||
let boundaries = self.line_boundaries();
|
||||
let (line, _, _) = self.cursor_line(&boundaries);
|
||||
self.move_cursor_to_line_col(frame, line, 0);
|
||||
self.record_cursor_col(frame);
|
||||
}
|
||||
|
||||
fn move_cursor_to_end_of_line(&mut self, frame: &mut Frame) {
|
||||
let boundaries = self.line_boundaries();
|
||||
let (line, _, _) = self.cursor_line(&boundaries);
|
||||
self.move_cursor_to_line_col(frame, line, usize::MAX);
|
||||
self.record_cursor_col(frame);
|
||||
}
|
||||
|
||||
fn move_cursor_up(&mut self, frame: &mut Frame) {
|
||||
let boundaries = self.line_boundaries();
|
||||
let (line, _, _) = self.cursor_line(&boundaries);
|
||||
|
|
@ -312,6 +326,14 @@ impl EditorState {
|
|||
self.0.lock().move_cursor_right(frame);
|
||||
}
|
||||
|
||||
pub fn move_cursor_to_start_of_line(&self, frame: &mut Frame) {
|
||||
self.0.lock().move_cursor_to_start_of_line(frame);
|
||||
}
|
||||
|
||||
pub fn move_cursor_to_end_of_line(&self, frame: &mut Frame) {
|
||||
self.0.lock().move_cursor_to_end_of_line(frame);
|
||||
}
|
||||
|
||||
pub fn move_cursor_up(&self, frame: &mut Frame) {
|
||||
self.0.lock().move_cursor_up(frame);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue