From ee2180472bddeb4ae97e122183b61058667d6a77 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 26 Sep 2022 16:11:38 -0600 Subject: [PATCH 1/2] goto_window_* extends selection --- helix-term/src/commands.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index c87ad0ca229c..db0d51a651db 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -885,8 +885,13 @@ fn goto_window(cx: &mut Context, align: Align) { .min(last_line.saturating_sub(scrolloff)); let pos = doc.text().line_to_char(line); - - doc.set_selection(view.id, Selection::point(pos)); + let text = doc.text().slice(..); + let selection = doc + .selection(view.id) + .clone() + .transform(|range| range.put_cursor(text, pos, cx.editor.mode == Mode::Select)); + push_jump(view, doc); + doc.set_selection(view.id, selection); } fn goto_window_top(cx: &mut Context) { From b782d4a8426d689bbe1b052a608f07d53b7e2352 Mon Sep 17 00:00:00 2001 From: greg-enbala <66078183+greg-enbala@users.noreply.github.com> Date: Mon, 26 Sep 2022 17:56:21 -0600 Subject: [PATCH 2/2] Don't push to the jumplist --- helix-term/src/commands.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index db0d51a651db..a6ba8a133244 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -890,7 +890,6 @@ fn goto_window(cx: &mut Context, align: Align) { .selection(view.id) .clone() .transform(|range| range.put_cursor(text, pos, cx.editor.mode == Mode::Select)); - push_jump(view, doc); doc.set_selection(view.id, selection); }