on master help sign in
added gg command
commitb7ef7985ee0b163e2e9c352a98886d46429379c4 authorJan Hrastnik <jan.hrastnik2@gmail.com> dateMon 5 Oct 2020, 15:37 (6 years ago) parent0382016
1 file changed+6−8
helix-view/src/commands.rs+6−8
helix-view/src/commands.rs+6−8
@@ -117,20 +117,18 @@ pub fn move_next_word_end(view: &mut View, count: usize) {
117117 view.state.selection = Selection::single(pos, pos);
118118}
119119
120−pub fn move_file_start(view: &mut View, count: usize) {
120+pub fn move_file_start(view: &mut View, _count: usize) {
121121 // TODO: use a transaction
122− view.state.selection = view
123− .state
124− .move_selection(Direction::Backward, Granularity::Line, count);
122+ view.state.selection = Selection::single(0, 0);
125123
126124 view.state.mode = Mode::Normal;
127125}
128126
129−pub fn move_file_end(view: &mut View, count: usize) {
127+pub fn move_file_end(view: &mut View, _count: usize) {
130128 // TODO: use a transaction
131− view.state.selection = view
132− .state
133− .move_selection(Direction::Forward, Granularity::Line, count);
129+ let text = &view.state.doc;
130+ let last_line = text.char_to_line(text.len_lines().checked_sub(1).unwrap());
131+ view.state.selection = Selection::single(last_line, last_line);
134132
135133 view.state.mode = Mode::Normal;
136134}