mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-06 00:41:15 -03:00
Hint at more matches at the bottom of the history pager
This commit is contained in:
@@ -509,6 +509,12 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co
|
||||
// Everything is filtered.
|
||||
progress_text = _(L"(no matches)");
|
||||
}
|
||||
if (!extra_progress_text.empty()) {
|
||||
if (!progress_text.empty()) {
|
||||
progress_text += L". ";
|
||||
}
|
||||
progress_text += extra_progress_text;
|
||||
}
|
||||
|
||||
if (!progress_text.empty()) {
|
||||
line_t &line = rendering->screen_data.add_line();
|
||||
@@ -869,6 +875,7 @@ void pager_t::clear() {
|
||||
fully_disclosed = false;
|
||||
search_field_shown = false;
|
||||
search_field_line.clear();
|
||||
extra_progress_text.clear();
|
||||
}
|
||||
|
||||
void pager_t::set_search_field_shown(bool flag) { this->search_field_shown = flag; }
|
||||
|
||||
@@ -142,6 +142,9 @@ class pager_t {
|
||||
// The text of the search field.
|
||||
editable_line_t search_field_line;
|
||||
|
||||
// Extra text to display at the bottom of the pager.
|
||||
wcstring extra_progress_text{};
|
||||
|
||||
// Sets the set of completions.
|
||||
void set_completions(const completion_list_t &raw_completions);
|
||||
|
||||
|
||||
@@ -570,6 +570,7 @@ struct highlight_result_t {
|
||||
struct history_pager_result_t {
|
||||
completion_list_t matched_commands;
|
||||
size_t final_index;
|
||||
bool have_more_results;
|
||||
};
|
||||
|
||||
/// readline_loop_state_t encapsulates the state used in a readline loop.
|
||||
@@ -1253,9 +1254,10 @@ static history_pager_result_t history_pager_search(const std::shared_ptr<history
|
||||
item.str(), L"", string_fuzzy_match_t::exact_match(),
|
||||
COMPLETE_REPLACES_COMMANDLINE | COMPLETE_DONT_ESCAPE | COMPLETE_DONT_SORT});
|
||||
}
|
||||
size_t last_index = search.current_index();
|
||||
if (direction == history_search_direction_t::forward)
|
||||
std::reverse(completions.begin(), completions.end());
|
||||
return {completions, search.current_index()};
|
||||
return {completions, last_index, search.go_to_next_match(direction)};
|
||||
}
|
||||
|
||||
void reader_data_t::fill_history_pager(bool new_search, history_search_direction_t direction) {
|
||||
@@ -1288,6 +1290,8 @@ void reader_data_t::fill_history_pager(bool new_search, history_search_direction
|
||||
shared_this->history_pager_history_index_start = index;
|
||||
shared_this->history_pager_history_index_end = result.final_index;
|
||||
}
|
||||
shared_this->pager.extra_progress_text =
|
||||
result.have_more_results ? _(L"Search again for more results") : L"";
|
||||
shared_this->pager.set_completions(result.matched_commands);
|
||||
shared_this->select_completion_in_direction(selection_motion_t::next, true);
|
||||
shared_this->super_highlight_me_plenty();
|
||||
|
||||
Reference in New Issue
Block a user