-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Implement basic pager using TerminalMenus #38956
Conversation
Nice! How hard would it be to implement a few more conveniences, in particular hotkeys for ...
|
Same for these,
I was also wondering whether it would be worth implementing this as well. Probably slightly more tricky to implement (as in not already provided 🤣). |
Nice! For me the most important really would be space and shift-space (can't easily type pageup/down without leaving the homerow on my keyboard. |
I think those should probably be a separate PR/discussion since they're generic to scrolling any kind of menu. I'm also not sure how to capture |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Just a couple of comments. Tests would be nice!
print(buf, pager.lines[idx]) | ||
end | ||
|
||
function writeLine(buf::IOBuffer, pager::Pager{<:Dict}, idx::Int, cursor::Bool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a new menu type, do you need to support the legacy interface? There wouldn't be any callers of it out in the wild, and no one using Julia 1.5 or earlier will be able to use the pager. So I think you can cleanly target the new API.
In case you're unfamiliar, see #35915.
Thanks for the review @timholy, I'll address the suggestions once I next get some spare time. |
Actually, for a menu, I'd expect space to toggle the currently "selected" item; so I am not sure this is separate? Anyway, of course things can be added later! I just think that it might be useful to have a look at the
Indeed, that seems to be a problem. But actually |
Co-authored-by: Tim Holy <tim.holy@gmail.com>
Thanks for updating this @vtjnash, I'm just going to add some tests to it now before it gets merged. |
This is cool but a bit buggy, at least under iTerm2. I'm sure it will get sorted out if we start using it though 😁 |
For reference, there is a related discussion on discourse revolving around the new package TerminalPager.jl (which also supports horizontal scrolling etc. However, it has dependencies like Crayons.jl |
Eventually, I think it would be cool and useful to have a |
This is just a quick initial draft of a terminal pager built with
TerminalMenus
that can be used to display objects that might take up more than a screen's worth of space vertically. See linked demo video for an example usage. If there's interest in having something like this in base then I'll put some docs, tests, etc in.Somewhat related: #6921, #36460, #34226