From 7d8009e9d628ac5b9da874c366f63e82e91799a6 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Tue, 9 Aug 2022 20:05:08 +0200 Subject: [PATCH] Disclose pager to half of screen height immediately (#9105) * Disclose pager to screen height immediately This removes that bit where we only show 4 rows at most at first, instead we disclose between half of terminal height up to the full terminal height (but still at least 4 rows). This results in less pressing of tab to get the other results, and better visibility of results. Unlike moving it to the actual top of the screen, it's not as jarring and doesn't push terminal history off-screen as much. Fixes #2698 --- src/pager.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pager.cpp b/src/pager.cpp index a02d55dbb..8294603b4 100644 --- a/src/pager.cpp +++ b/src/pager.cpp @@ -425,7 +425,15 @@ bool pager_t::completion_try_print(size_t cols, const wcstring &prefix, const co this->available_term_height - 1 - (search_field_shown ? 1 : 0); // we always subtract 1 to make room for a comment row if (!this->fully_disclosed) { - term_height = std::min(term_height, static_cast(PAGER_UNDISCLOSED_MAX_ROWS)); + // We disclose between half and the entirety of the terminal height, + // but at least 4 rows. + // + // We do this so we show a useful amount but don't force fish to + // THE VERY TOP, which is jarring. + term_height = std::min(term_height, + std::max(term_height / 2, + static_cast(PAGER_UNDISCLOSED_MAX_ROWS)) + ); } size_t row_count = divide_round_up(lst.size(), cols);