From 63ff9309cee6c5a8b361f2e56f0f69228aa1f1b3 Mon Sep 17 00:00:00 2001 From: greg-enbala <66078183+greg-enbala@users.noreply.github.com> Date: Mon, 3 Oct 2022 10:55:26 -0400 Subject: [PATCH] goto_window_* extends selection (#3985) * goto_window_* extends selection * Don't push to the jumplist --- helix-term/src/commands.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index cb561d6d..fc5c2063 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -885,8 +885,12 @@ 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)); + doc.set_selection(view.id, selection); } fn goto_window_top(cx: &mut Context) {