Skip to content

Commit

Permalink
Don't re-order selections
Browse files Browse the repository at this point in the history
  • Loading branch information
ConradIrwin committed May 9, 2024
1 parent ecd328d commit 22fd2cc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions crates/vim/src/normal/mark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{ops::Range, sync::Arc};

use collections::HashSet;
use editor::{
display_map::{DisplaySnapshot, ToDisplayPoint},
movement,
Expand Down Expand Up @@ -112,7 +111,7 @@ pub fn jump(text: Arc<str>, line: bool, cx: &mut WindowContext) {
Vim::update(cx, |vim, cx| {
vim.update_active_editor(cx, |_, editor, cx| {
let map = editor.snapshot(cx);
let mut ranges: HashSet<Range<Anchor>> = HashSet::default();
let mut ranges: Vec<Range<Anchor>> = Vec::new();
for mut anchor in anchors {
if line {
let mut point = anchor.to_display_point(&map.display_snapshot);
Expand All @@ -122,7 +121,9 @@ pub fn jump(text: Arc<str>, line: bool, cx: &mut WindowContext) {
.buffer_snapshot
.anchor_before(point.to_point(&map.display_snapshot));
}
ranges.insert(anchor..anchor);
if ranges.last() != Some(&(anchor..anchor)) {
ranges.push(anchor..anchor);
}
}
editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
s.select_anchor_ranges(ranges)
Expand Down

0 comments on commit 22fd2cc

Please sign in to comment.