diff options
author | CossonLeo | 2021-11-02 04:32:57 +0000 |
---|---|---|
committer | GitHub | 2021-11-02 04:32:57 +0000 |
commit | 1720b98760eb5958a31bc6e2b88564dbf5bf63e5 (patch) | |
tree | 29d49a0c11e36dce2bdba966f4ce0fe1de0b6164 | |
parent | 44ff597841dc666f1bf52e3e05544edff927821b (diff) |
only remove primary index when search next without extend (#948)
-rw-r--r-- | helix-term/src/commands.rs | 5 |
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); |