-
-
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
refactor tty_rows, tty_cols #4117
Comments
Using infinite (or |
Yes. But the awkwardness comes from the fact that usually the Display controls what the size is, but in that case the user wants to control it. |
Nice that others are thinking about this issue also. I tried to raise the issue in #3932 (comment), but @stevengj did not approve then. Maybe because he was focused on images. I have thought of different solutions to give this hint to the writemime function, but my only suggestion is to use a Dict{String,Int} and document the interpretation of some possible keys ( like c_cols/c_rows, p_hight/p_widht, max_size_mb). The same dictionary can be used as an optional argument to display so that the user is able to override the default size parameters from the display driver. |
The key is to attach this information to the correct abstraction. The thing is, the |
I tend to think that the number of rows/cols to display for truncated |
So you don't want it to be responsive to the size of the display? That seems like a step backwards. |
First of all, if you want the global preference to be responsive to the size of the TTY, you can do that, just don't tie it to the Second, it is not clear that one wants it to be responsive to the size of the display (at least, not by default). When I make my terminal window bigger, what makes you think that means I want to see more rows of matrices? Maybe I would rather see more of the command history instead. And if I make my terminal window only 5 lines high, what makes you think that means I only want to see 5 lines of matrices? Maybe I still want to see 30 lines, and just don't mind scrolling. |
PS: Responsive to the size of display is much more useful for the width than the height of the terminal. Horizontal scrolling is usually not that pleasant. |
@ivarne, you are missing the point. I have no problem with some (generally type-dependent) setting for how Note that mismatching the horizontal size is only really a pain in a terminal. In a browser display like IJulia, scrolling is potentially not as problematic, and it is perfectly sensible to show a fixed portion of a matrix (e.g. fitting into 30x80 characters) independent of the size of the browser window. |
Right now, if the user (or a module like |
…ernel is started; pick a sensible default (see JuliaLang/julia#4117)
Hence, I agree with others that it's nice to be able to adjust output to the display size. |
If a
We could make this a bit easier via a |
Just to add my 2 cents... Pandas on python does a rather nice job of formatting DataFrames for display, but I find it frustrating that it can't figure out my display size and formats everything for 80 columns until I tell it otherwise. Ditto with Matlab and matrix display (at least older versions--I haven't used it recently). For me, at least, I would prefer my matrices (and similar objects) to actually display using the full extent of the terminal that it's running in. |
Yes, I feel pretty strongly that using the current display size is a much better user experience. I really like the way the Julia repl shows you only as much of a matrix as will fit in your window (not surprising since I implemented that behavior). Doing a fixed-size output would be a major regression in user experience in my view. |
As I am apparently missing the point, I have not commented more on this thread for a week. I still feel that there is an obvious solution to this problem that has not been discussed and that @stevengj still has not convinced me that is stupid. It does involve API changes that should be done before 0.2. The signatures can be extended to take an optional list of named arguments, so that they write I tried to write some draft documentation and it is available at https://gist.github.com/ivarne/a04426ff124962cf64d0 |
Bump! My suggestion involves an API change for I think character rows and cols is one part of a more general problem of how to enable options when converting data to a MIME standard representation. It would be better to have a general way of supplying these options instead of different configuration functions for each module and option. |
Agreed that the client either needs to be able to control or learn what the display setting are (and preferably both). An alternative to the keyword arguments would be to do something like this (apologies for not taking the time to see how the display code is actually implemented, maybe this already exists):
and then you can query/set Of course base |
I also agree with @ivarne that this is pretty important. Where possible it should be bidirectional. For example, consider plotting an enormous image in a small amount of screen space, which means it has to be downsampled. There is little point transmitting all that pixel data over a slow network connection, might as well downsample at the source of the data. |
It is very hard to reduce the resolution on bitmap graphs if it contains dots or lines that only extend to one pixel. A general algorithm won't recognize those very important features, and some lines and points will just disappear. |
Yes. Any display software has to solve the same problem (monitors have only so many pixels), and there's no universally-acceptable answer. Being able to control the algorithm used to do that is another reason to encourage this effort. |
My biggest concern with this, aside from the question of defining useful metadata, is that every single One alternative would be to have a Yes, these are awful names, but I'm sure better could be devised; if @JeffBezanson implements dispatch based on the presence of keywords, they can even be called |
MIME types have optional parameters, e.g.,
|
@nolta, that sounds like a very interesting idea, and I like the fact that it could potentially be implemented transparently without changing the dispatch signatures. |
EDIT: Sorry, I did not understand. I'll wait for the rest of the discussion. |
If we're going to have MIME types in Base Julia, I think they should faithfully reproduce the features of mimetypes – a type (parameter), a subtype (also a parameter), and zero or more options, stored in a dict. That way you can dispatch on the type and the subtype and access the options. |
Closing in favor of #5709; we need a better way to deal with printing parameters like output limiting. |
With the
display
subsystem in place, these functions don't really make sense or work correctly any more. There should be a way for Displays to indicate their size, and types that implementshow
and/orwritemime
to determine this size if they want to truncate their output.We could add a
displaysize
function that works similarly todisplay
. Displays can overload it, and calling it asdisplaysize([mimetype])
will tell you the size. Maybe there could be some way to get the equivalent ofshowall
using something likewith_display_size
.The text was updated successfully, but these errors were encountered: