From a447cc38a9fab78df135e39f8b7c8170c69730e7 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 27 Jul 2022 21:14:01 +0200 Subject: [PATCH] Hint at more matches at the bottom of the history pager --- src/pager.cpp | 7 +++++++ src/pager.h | 3 +++ src/reader.cpp | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/pager.cpp b/src/pager.cpp index 8eb0dee10..a02d55dbb 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -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; } diff --git a/src/pager.h b/src/pager.h index 4fca05790..cefd93e0f 100644 --- a/src/pager.h +++ b/src/pager.h @@ -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); diff --git a/src/reader.cpp b/src/reader.cpp index 8f9052f73..f0f9a0f13 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -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_ptrhistory_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();