aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorCossonLeo2021-11-02 04:32:57 +0000
committerGitHub2021-11-02 04:32:57 +0000
commit1720b98760eb5958a31bc6e2b88564dbf5bf63e5 (patch)
tree29d49a0c11e36dce2bdba966f4ce0fe1de0b6164 /helix-term/src
parent44ff597841dc666f1bf52e3e05544edff927821b (diff)
only remove primary index when search next without extend (#948)
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs5
1 files changed, 4 insertions, 1 deletions
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);