Skip to content

Commit

Permalink
Disclose pager to half of screen height immediately (#9105)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
faho committed Aug 9, 2022
1 parent d7b8261 commit 7d8009e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/pager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7d8009e

Please sign in to comment.