Closed bjarthur closed 7 months ago
Array(A) |> pager
works of course but then the lookup values are not shown which defeats the point of DimensionalData
Hi @bjarthur !
TerminalPager.jl just take the default show method for each type. In this case, I am not sure if I understood the problem.
in this case, A
has 50 rows, but only 11 are displayed by pager, the rest of the screen is just blank instead of being used to display more rows.
Ah! That should be a problem in the display function of DimensionalData. When we render the output to be shown in the pager, we use this context: IOContext(buf, :color => hascolor, :limit => false)
. Meaning that the output must not be limited. Probably DimensionalData is getting the display size (that defaults to 24 x 80), and using this as the screen size.
yet if i just type A
on the REPL, 28 rows are displayed, not 11 like in pager
Because in REPL, we use stdout
, and its dimension is whatever you have in your terminal. However, when we create the IOContext, we do not have dimensions (it is a pager). By default, Julia returns 24 x 80
. That's why we have :limit => false
. I cannot manually set the size to (-1, -1)
because it can lead to many problems. The only right thing to do here is modifying DimensionalData to honor the :limit
flag.
julia> displaysize(stdout)
(39, 128)
julia> displaysize(IOContext(IOBuffer(), :limit => false))
(24, 80)
That's why it works with Array
. In this case, if :limit => false
, Julia prints the array without cropping.
Thanks @ronisbr for solving this!
You’re welcome @rafaqz! Awesome package by the way!
is there a show method or the like that can be defined to customize the output for a specific type to make this work better?
this is on julia v1.10 with DimensionalData v0.25.8 and TerminalPager v0.5.1