From 1720b98760eb5958a31bc6e2b88564dbf5bf63e5 Mon Sep 17 00:00:00 2001 From: CossonLeo Date: Tue, 2 Nov 2021 12:32:57 +0800 Subject: only remove primary index when search next without extend (#948) --- helix-term/src/commands.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'helix-term/src') diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 28657865..cc9106eb 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1161,7 +1161,10 @@ fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Rege let selection = if extend { selection.clone().push(Range::new(start, end)) } else { - Selection::single(start, end) + selection + .clone() + .remove(selection.primary_index()) + .push(Range::new(start, end)) }; doc.set_selection(view.id, selection); -- cgit v1.2.3-70-g09d2