on master help sign in
only remove primary index when search next without extend (#948)
commit1720b98760eb5958a31bc6e2b88564dbf5bf63e5 authorCossonLeo <20379044+cossonleo@users.noreply.github.com> dateTue 2 Nov 2021, 12:32 (5 years ago) parent44ff597
1 file changed+4−1
helix-term/src/commands.rs+4−1
helix-term/src/commands.rs+4−1
@@ -1161,7 +1161,10 @@ fn search_impl(doc: &mut Document, view: &mut View, contents: &str, regex: &Rege
11611161 let selection = if extend {
11621162 selection.clone().push(Range::new(start, end))
11631163 } else {
1164− Selection::single(start, end)
1164+ selection
1165+ .clone()
1166+ .remove(selection.primary_index())
1167+ .push(Range::new(start, end))
11651168 };
11661169
11671170 doc.set_selection(view.id, selection);