on master help sign in
added gg command
b7ef798Jan Hrastnik
helix-view/src/commands.rs+6−8
@@ -117,20 +117,18 @@ pub fn move_next_word_end(view: &mut View, count: usize) {
117 view.state.selection = Selection::single(pos, pos);
117 view.state.selection = Selection::single(pos, pos);
118}
118}
119
119
120−pub fn move_file_start(view: &mut View, count: usize) {
120+pub fn move_file_start(view: &mut View, _count: usize) {
121 // TODO: use a transaction
121 // TODO: use a transaction
122− view.state.selection = view
122+ view.state.selection = Selection::single(0, 0);
123− .state
124− .move_selection(Direction::Backward, Granularity::Line, count);
125
123
126 view.state.mode = Mode::Normal;
124 view.state.mode = Mode::Normal;
127}
125}
128
126
129−pub fn move_file_end(view: &mut View, count: usize) {
127+pub fn move_file_end(view: &mut View, _count: usize) {
130 // TODO: use a transaction
128 // TODO: use a transaction
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 = view
131+ view.state.selection = Selection::single(last_line, last_line);
132− .state
133− .move_selection(Direction::Forward, Granularity::Line, count);
134
132
135 view.state.mode = Mode::Normal;
133 view.state.mode = Mode::Normal;
136}
134}