mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 14:01:20 -03:00
history search: prune call graph
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user