on master help sign in
goto_window_* extends selection (#3985)

* goto_window_* extends selection * Don't push to the jumplist

commit63ff9309cee6c5a8b361f2e56f0f69228aa1f1b3 authorgreg-enbala <66078183+greg-enbala@users.noreply.github.com> dateMon 3 Oct 2022, 10:55 (4 years ago) parentb9ff5d0
1 file changed+6−2
helix-term/src/commands.rs+6−2
helix-term/src/commands.rs+6−2
@@ -885,8 +885,12 @@ fn goto_window(cx: &mut Context, align: Align) {
885885 .min(last_line.saturating_sub(scrolloff));
886886
887887 let pos = doc.text().line_to_char(line);
888−
889− doc.set_selection(view.id, Selection::point(pos));
888+ let text = doc.text().slice(..);
889+ let selection = doc
890+ .selection(view.id)
891+ .clone()
892+ .transform(|range| range.put_cursor(text, pos, cx.editor.mode == Mode::Select));
893+ doc.set_selection(view.id, selection);
890894}
891895
892896fn goto_window_top(cx: &mut Context) {