history search: prune call graph

This commit is contained in:
Johannes Altmanninger
2026-01-22 15:08:13 +01:00
parent 9d260cac0b
commit 78e91e6bc4

View File

@@ -5740,23 +5740,20 @@ fn history_pager_search(
// (subtract 2 for the search line and the prompt) // (subtract 2 for the search line and the prompt)
let page_size = cmp::max(termsize_last().height() / 2 - 2, 12); let page_size = cmp::max(termsize_last().height() / 2 - 2, 12);
let mut completions = Vec::with_capacity(page_size); let mut completions = Vec::with_capacity(page_size);
let mut search = HistorySearch::new_with( let new_search = |search_type| {
history.clone(), HistorySearch::new_with(
search_string.to_owned(), history.clone(),
SearchType::ContainsGlob, search_string.to_owned(),
smartcase_flags(search_string), search_type,
history_index, smartcase_flags(search_string),
); history_index,
)
};
let mut search = new_search(SearchType::ContainsGlob);
if !search.go_to_next_match(direction) && !contains_wildcards(search_string) { if !search.go_to_next_match(direction) && !contains_wildcards(search_string) {
// If there were no matches, and the user is not intending for // If there were no matches, and the user is not intending for
// wildcard search, try again with subsequence search. // wildcard search, try again with subsequence search.
search = HistorySearch::new_with( search = new_search(SearchType::ContainsSubsequence);
history.clone(),
search_string.to_owned(),
SearchType::ContainsSubsequence,
smartcase_flags(search_string),
history_index,
);
search.go_to_next_match(direction); search.go_to_next_match(direction);
} }
// When searching, first we need to find the element before first shown. // When searching, first we need to find the element before first shown.