To echo
what @giordano said,
I would encourage using the word pager
instead of less
, since this isn’t actually using less
and the less
name is an obscure Unix joke (a backwards version of more
) unfamiliar to some programmers.
To echo
what @giordano said,
I would encourage using the word pager
instead of less
, since this isn’t actually using less
and the less
name is an obscure Unix joke (a backwards version of more
) unfamiliar to some programmers.
not gonna lie, my heart raced when I causally clicked on this post and saw my name.
This looks great! thanks for all the work on PrettyTables and this!
Yes, you are right. Maybe crop = :pager
then.
Tried in Win10 REPL terminal but do not manage to step-out by 10 columns when using SHIFT + left/right arrows.
IMHO and if it is not asking too much , this pager would be even more useful if the row numbers and column numbers would always show up (like the freeze function in MS Excel).
Thanks for your feedback! And sorry for not referencing you properly, I did not find your name in the list here on Discourse
This is difficult because it depends on the type of data you are printing.
Though I would say = TerminalPager.pager
or = TerminalPager.Pager
is better than = :pager
– functions (or objects) are better than symbols. Because then you don’t need a case analysis inside, you can just call whatever function was handed to you.
I mean, this would be inside PrettyTables. You have an option crop = :none
, crop = :vertical
, crop = :horizontal
, crop = :both
, and I would like to add crop = :pager
.
The crop parameter seems like it really wants to be a function object (\text{terminal size}, \text{string}) \to \text{string}, which seems different from what this pager is doing.
No, it is just an option to switch between cropping mechanism in pretty_table
. It cannot be an external function due to performance. PrettyTables avoid rendering lines and columns that won’t be shown.
I haven’t benchmarked it so I’ll pipe down
would it make sense to have this as default for Julia doc strings in REPL? I find long docstring is hard to read sometimes, also FYI IPython has this as builtin feature I think.
It makes sense! However, to make this available in Julia by default, we need a lot of tests! I count on the community to help me stabilize everything and find bugs
Question: pager
seems not an usual word. I think we can export it so that people can use it more easily (typing less):
julia> @doc(pretty_tables) |> pager
What do you think?
Any way to change the keybindings? My terminal emulator steals all Shift + arrows sequences, so I can’t ever move quicker than one column/row at the time
One thing that would be really nice would be to show the column names when scrolling down through a large table. I guess you could do that if there was an easy way to freeze the first few rows of output (for a prettytables printout of a dataframe, it would be 4?)
This is one of those packages where I think to myself, “This is such a genius idea! Why isn’t this already in base?”
Kudos on a great package - looking forward to using it!
So this is glorious. Far exceeded my expectation that someone wrote a hook between a pager and a terminal window. I mean… I’d be happy to have either, but seeing this - it’s very useful.
Edit - if you don’t know what a pager is ask a parent or google.
There was this recently merged PR which has some overlap with this package https://github.com/JuliaLang/julia/pull/38956 (though horizontal scrolling might not be in its scope; but display of long documentation certainly could be).
Unfortunately they are hard-coded in this version, but it can be easily done. I will think about a good way to make this configurable.
Hum, it is very easy to freeze lines and columns when printing. In fact, this would also solve the request of @rafael.guerra. However, the user would need to select how many lines and columns they want to freeze, it cannot be automatically inferred. I will try to do that
Thank you very much !
Thanks! Yeah, I am afraid I am from this generation that actually knows what a pager is… I am becoming somewhat old I think
Nice! I did not know about that, thanks for pointing this out.