diff options
author | Jan Hrastnik | 2020-10-05 13:37:33 +0000 |
---|---|---|
committer | Jan Hrastnik | 2020-10-05 13:37:33 +0000 |
commit | b7ef7985ee0b163e2e9c352a98886d46429379c4 (patch) | |
tree | 94e01e26ba196c7627a558126040a5b45cfc221a /helix-view | |
parent | 038201647c657b2b07fa7f87aae3c609c59c77ef (diff) |
added gg command
Diffstat (limited to 'helix-view')
-rw-r--r-- | helix-view/src/commands.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs index eb9aaf6f..63084520 100644 --- a/helix-view/src/commands.rs +++ b/helix-view/src/commands.rs @@ -117,20 +117,18 @@ pub fn move_next_word_end(view: &mut View, count: usize) { view.state.selection = Selection::single(pos, pos); } -pub fn move_file_start(view: &mut View, count: usize) { +pub fn move_file_start(view: &mut View, _count: usize) { // TODO: use a transaction - view.state.selection = view - .state - .move_selection(Direction::Backward, Granularity::Line, count); + view.state.selection = Selection::single(0, 0); view.state.mode = Mode::Normal; } -pub fn move_file_end(view: &mut View, count: usize) { +pub fn move_file_end(view: &mut View, _count: usize) { // TODO: use a transaction - view.state.selection = view - .state - .move_selection(Direction::Forward, Granularity::Line, count); + let text = &view.state.doc; + let last_line = text.char_to_line(text.len_lines().checked_sub(1).unwrap()); + view.state.selection = Selection::single(last_line, last_line); view.state.mode = Mode::Normal; } |