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

REPL: make terminating with a trailing colon display output with 1000 row limit #47520

Closed

Conversation

IanButterworth
Copy link
Member

@IanButterworth IanButterworth commented Nov 10, 2022

Updated to a single trailing :


This is a proposal to make terminating input in the repl with ;; a convenient way to display output without row limit.

Sometimes you just want to see the entire object, printed in the nice formatting that display provides, without truncating to the terminal window height.

When generating this the terminal window was quite short to illustrate the effect.

julia> d = Dict(i => i for i in 1:20)
Dict{Int64, Int64} with 20 entries:
  5  => 5
  16 => 16
  7  => 7
  20 => 20
  12 => 12
  8  => 8
  17 => 17
  1  => 1
  ⋮  => ⋮

julia> 

A single ; still suppresses output.

julia> d;

julia> 

Double ;; allows display to show all rows (requiring the user to scroll up)

julia> d;;
Dict{Int64, Int64} with 20 entries:
  5 => 5
  16 => 16
  7 => 7
  20 => 20
  12 => 12
  8 => 8
  17 => 17
  1 => 1
  19 => 19
  4 => 4
  6 => 6
  13 => 13
  2 => 2
  10 => 10
  11 => 11
  9 => 9
  15 => 15
  18 => 18
  14 => 14
  3 => 3

julia>

@vtjnash vtjnash added the triage This should be discussed on a triage call label Nov 10, 2022
@JeffBezanson
Copy link
Member

This is a good feature but triage does not like using more semicolons to trigger it.

@Seelengrab
Copy link
Contributor

This could be done as a REPL setting ala #41435, e.g. to enable the pager.

@jariji
Copy link
Contributor

jariji commented Nov 10, 2022

I have showall(x) = show(stdout, "text/plain", x) in my startup.jl for this.

@JeffBezanson JeffBezanson removed the triage This should be discussed on a triage call label Nov 10, 2022
@IanButterworth
Copy link
Member Author

I'll try to not die on the hill of ;;, but my proposal is to make ; in the repl conceptually an output modifier. 0 is default, 1 suppresses, 2 makes verbose, 3 ...

Did triage happen to think of any other trailing etc. chars that could be used?

@IanButterworth
Copy link
Member Author

I've switched it over to if there's a trailing space.

Also, the limit now extends to 1000 rows, for safety if a very large object is displayed accidentally.

@vtjnash vtjnash changed the title REPL: make terminating with two semicolons display output without row limit REPL: make terminating with a trailing space to display output with 1000 row limit Nov 14, 2022
@jishnub
Copy link
Contributor

jishnub commented Nov 14, 2022

I find this behavior somewhat unintuitive, as I'd expect invisible whitespace characters to not change the output. Can't this setting be more explicit, perhaps something like np.set_printoptions?

@IanButterworth
Copy link
Member Author

Putting this setting under a menu does seem reasonable, I just prefer the ease of doing it very easily, something like this PR does.

If there was an options repl added, it could definitely go in there as a sticky setting too. I just think it should be achievable with some simple instruction on an individual input.

@IanButterworth
Copy link
Member Author

How do people feel about a trailing colon?

julia> x
{default show limited}

julia> x;
{no show}

julia> x:
{show all (1000 row limit)}

@IanButterworth IanButterworth changed the title REPL: make terminating with a trailing space to display output with 1000 row limit REPL: make terminating with a trailing colon display output with 1000 row limit Dec 8, 2022
@IanButterworth IanButterworth added the triage This should be discussed on a triage call label Dec 8, 2022
@IanButterworth
Copy link
Member Author

Marking this for a hopefully brief re-triage for the idea of using a trailing colon.

else
before = get(Base.active_repl.options.iocontext, :displaysize, nothing)
try
Base.active_repl.options.iocontext[:displaysize] = (1000, displaysize(io)[2])
Copy link
Member

Choose a reason for hiding this comment

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

Should the 1000 value be configurable somehow? Someone will inevitably ask...

@oscardssmith
Copy link
Member

triage still doesn't like this with trailing : or the fixed number limit and thinks this should be a macro of some sort.
Possibly, this should be @pretty x (similar to @show but with pretty-printing). The name is highly bikesheddable.

@IanButterworth IanButterworth deleted the ib/unlimit_rows branch February 2, 2023 21:55
@LilithHafner LilithHafner removed the triage This should be discussed on a triage call label Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants