Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make history pager use more entries #9458

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

faho
Copy link
Member

@faho faho commented Jan 9, 2023

Like I mentioned in #9089, 12 entries is a bit few.

So, instead, we do like we do for completions before disclosing and
pick half the screen (but at least X, in this case 12).

This avoids filling the entire screen, and will avoid an unsightly "X
more entries" (which requires scrolling down to fully disclose)
because it matches what the pager does.

Note: For multiline commands we can be pushed further upwards, and in
case of a multi-column layout we could fit more lines. That would
require asking the pager to fit as many as possible and give us back
the index of the last matching entry and rewinding the history search.

That's gonna be left as an exercise for later if it turns out to be necessary.

Like I mentioned in fish-shell#9089, 12 entries is a bit few.

So, instead, we do like we do for completions before disclosing and
pick half the screen (but at least X, in this case 12).

This avoids filling the entire screen, and will avoid an unsightly "X
more entries" (which requires scrolling down to fully disclose)
because it matches what the pager does.

Note: For multiline commands we can be pushed further upwards, and in
case of a multi-column layout we could fit more lines. That would
require asking the pager to fit as many as possible and give us back
the index of the last matching entry and rewinding the history search.

That's gonna be left as an exercise for later if it turns out to be necessary.
This could lead to "and 2 more entries" because of the search and the prompt
@faho faho added this to the fish 3.6.1 milestone Jan 9, 2023
@faho faho requested a review from krobelus January 9, 2023 18:00
//
// We can still push fish further upward in case the first entry is multiline,
// but that can't really be helped.
// (subtract 2 for the search line and the prompt)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this behavior is definitely much nicer, thanks.
My original concern was that it can be difficult to select things in the pager.
I think that's not really relevant in practice because most searches can easily be refined to match fewer commands.
Also we'll add globbing soon.

@krobelus
Copy link
Member

krobelus commented Jan 9, 2023

random future ideas: use the alternate screen like fzf
perhaps with a single-column layout if there's enough space, because single-column a bit easier to scan

@faho faho merged commit 5792e4a into fish-shell:master Jan 9, 2023
@faho faho deleted the hist-pager-more-lines branch January 9, 2023 20:40
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants