mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-23 01:46:18 +04:00
Fix bugs in search wraparound message (#4101)
This commit is contained in:
parent
ccb38e7696
commit
c927d61791
@ -1561,6 +1561,7 @@ fn split_selection_on_newline(cx: &mut Context) {
|
|||||||
doc.set_selection(view.id, selection);
|
doc.set_selection(view.id, selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn search_impl(
|
fn search_impl(
|
||||||
editor: &mut Editor,
|
editor: &mut Editor,
|
||||||
contents: &str,
|
contents: &str,
|
||||||
@ -1569,6 +1570,7 @@ fn search_impl(
|
|||||||
direction: Direction,
|
direction: Direction,
|
||||||
scrolloff: usize,
|
scrolloff: usize,
|
||||||
wrap_around: bool,
|
wrap_around: bool,
|
||||||
|
show_warnings: bool,
|
||||||
) {
|
) {
|
||||||
let (view, doc) = current!(editor);
|
let (view, doc) = current!(editor);
|
||||||
let text = doc.text().slice(..);
|
let text = doc.text().slice(..);
|
||||||
@ -1609,9 +1611,13 @@ fn search_impl(
|
|||||||
regex.find_iter(&contents[start..]).last()
|
regex.find_iter(&contents[start..]).last()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
editor.set_status("Wrapped around document");
|
}
|
||||||
} else {
|
if show_warnings {
|
||||||
editor.set_error("No more matches");
|
if wrap_around && mat.is_some() {
|
||||||
|
editor.set_status("Wrapped around document");
|
||||||
|
} else {
|
||||||
|
editor.set_error("No more matches");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1706,6 +1712,7 @@ fn searcher(cx: &mut Context, direction: Direction) {
|
|||||||
direction,
|
direction,
|
||||||
scrolloff,
|
scrolloff,
|
||||||
wrap_around,
|
wrap_around,
|
||||||
|
false,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -1740,6 +1747,7 @@ fn search_next_or_prev_impl(cx: &mut Context, movement: Movement, direction: Dir
|
|||||||
direction,
|
direction,
|
||||||
scrolloff,
|
scrolloff,
|
||||||
wrap_around,
|
wrap_around,
|
||||||
|
true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user