mirror of https://github.com/helix-editor/helix
Respect mode when starting a search (#10505)
Currently the editor mode has no effect on the behavior of `search` and `rsearch`. We can pass in the right movement for the editor mode to make the behavior or `search` and `rsearch` match `search_next` and `search_prev` in select mode.pull/10527/head
parent
18d5cacea6
commit
211f368064
|
@ -2080,6 +2080,11 @@ fn searcher(cx: &mut Context, direction: Direction) {
|
||||||
let config = cx.editor.config();
|
let config = cx.editor.config();
|
||||||
let scrolloff = config.scrolloff;
|
let scrolloff = config.scrolloff;
|
||||||
let wrap_around = config.search.wrap_around;
|
let wrap_around = config.search.wrap_around;
|
||||||
|
let movement = if cx.editor.mode() == Mode::Select {
|
||||||
|
Movement::Extend
|
||||||
|
} else {
|
||||||
|
Movement::Move
|
||||||
|
};
|
||||||
|
|
||||||
// TODO: could probably share with select_on_matches?
|
// TODO: could probably share with select_on_matches?
|
||||||
let completions = search_completions(cx, Some(reg));
|
let completions = search_completions(cx, Some(reg));
|
||||||
|
@ -2104,7 +2109,7 @@ fn searcher(cx: &mut Context, direction: Direction) {
|
||||||
search_impl(
|
search_impl(
|
||||||
cx.editor,
|
cx.editor,
|
||||||
®ex,
|
®ex,
|
||||||
Movement::Move,
|
movement,
|
||||||
direction,
|
direction,
|
||||||
scrolloff,
|
scrolloff,
|
||||||
wrap_around,
|
wrap_around,
|
||||||
|
|
Loading…
Reference in New Issue