1
0
mirror of https://github.com/helix-editor/helix synced 2024-11-10 10:34:45 +01:00

Fix repeat last motion for goto next/prev diagnostic (#9966)

This commit is contained in:
Jaakko Paju 2024-03-23 08:25:08 +02:00 committed by GitHub
parent be307a4204
commit d5c2973cd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 32 deletions

@ -49,7 +49,7 @@ Normal mode is the default mode when you launch helix. You can return to it from
| `T` | Find 'till previous char | `till_prev_char` | | `T` | Find 'till previous char | `till_prev_char` |
| `F` | Find previous char | `find_prev_char` | | `F` | Find previous char | `find_prev_char` |
| `G` | Go to line number `<n>` | `goto_line` | | `G` | Go to line number `<n>` | `goto_line` |
| `Alt-.` | Repeat last motion (`f`, `t` or `m`) | `repeat_last_motion` | | `Alt-.` | Repeat last motion (`f`, `t`, `m`, `[` or `]`) | `repeat_last_motion` |
| `Home` | Move to the start of the line | `goto_line_start` | | `Home` | Move to the start of the line | `goto_line_start` |
| `End` | Move to the end of the line | `goto_line_end` | | `End` | Move to the end of the line | `goto_line_end` |
| `Ctrl-b`, `PageUp` | Move page up | `page_up` | | `Ctrl-b`, `PageUp` | Move page up | `page_up` |

@ -3439,7 +3439,8 @@ fn goto_last_diag(cx: &mut Context) {
} }
fn goto_next_diag(cx: &mut Context) { fn goto_next_diag(cx: &mut Context) {
let (view, doc) = current!(cx.editor); let motion = move |editor: &mut Editor| {
let (view, doc) = current!(editor);
let cursor_pos = doc let cursor_pos = doc
.selection(view.id) .selection(view.id)
@ -3457,10 +3458,14 @@ fn goto_next_diag(cx: &mut Context) {
None => return, None => return,
}; };
doc.set_selection(view.id, selection); doc.set_selection(view.id, selection);
};
cx.editor.apply_motion(motion);
} }
fn goto_prev_diag(cx: &mut Context) { fn goto_prev_diag(cx: &mut Context) {
let (view, doc) = current!(cx.editor); let motion = move |editor: &mut Editor| {
let (view, doc) = current!(editor);
let cursor_pos = doc let cursor_pos = doc
.selection(view.id) .selection(view.id)
@ -3481,6 +3486,8 @@ fn goto_prev_diag(cx: &mut Context) {
None => return, None => return,
}; };
doc.set_selection(view.id, selection); doc.set_selection(view.id, selection);
};
cx.editor.apply_motion(motion)
} }
fn goto_first_change(cx: &mut Context) { fn goto_first_change(cx: &mut Context) {