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
This commit is contained in:
Fabian Boehm
2022-08-09 20:05:08 +02:00
committed by GitHub
parent d7b82618ec
commit 7d8009e9d6

View File

@@ -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<size_t>(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<size_t>(PAGER_UNDISCLOSED_MAX_ROWS))
);
}
size_t row_count = divide_round_up(lst.size(), cols);