diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 28657865b..cc9106eb7 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);