From 22fd2cccec9469b30e9e16fd5e2d0620963c2ecc Mon Sep 17 00:00:00 2001 From: Conrad Irwin Date: Thu, 9 May 2024 16:31:45 -0600 Subject: [PATCH] Don't re-order selections --- crates/vim/src/normal/mark.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/vim/src/normal/mark.rs b/crates/vim/src/normal/mark.rs index ee8862b245b1..0c6ff2f13777 100644 --- a/crates/vim/src/normal/mark.rs +++ b/crates/vim/src/normal/mark.rs @@ -1,6 +1,5 @@ use std::{ops::Range, sync::Arc}; -use collections::HashSet; use editor::{ display_map::{DisplaySnapshot, ToDisplayPoint}, movement, @@ -112,7 +111,7 @@ pub fn jump(text: Arc, 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> = HashSet::default(); + let mut ranges: Vec> = Vec::new(); for mut anchor in anchors { if line { let mut point = anchor.to_display_point(&map.display_snapshot); @@ -122,7 +121,9 @@ pub fn jump(text: Arc, 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)