Skip to content

Commit 63ff930

Browse files
authored
goto_window_* extends selection (#3985)
* goto_window_* extends selection * Don't push to the jumplist
1 parent b9ff5d0 commit 63ff930

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

helix-term/src/commands.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

892896
fn goto_window_top(cx: &mut Context) {

0 commit comments

Comments
 (0)