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

Shorten leaf printing #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Shorten leaf printing #53

wants to merge 3 commits into from

Conversation

mcabbott
Copy link
Member

@mcabbott mcabbott commented Feb 5, 2022

If you print the status of the example in the docs at the readme, this makes it about 4 screenfuls, instead of 20something. But shows a few numbers so that you can see whether the state is all zero. RFC?

src/interface.jl Outdated
show(ioc, ℓ.rule)
printstyled(", "; color = :green)
str = sprint(show, ℓ.state; context = ioc)
print(io, length(str) < 70 ? str : first(str, 50) * " … ")
Copy link
Member

Choose a reason for hiding this comment

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

Is there functionality in Base or InteractiveUtils that can help cut down on magic numbers?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think you can get terminal size, but don't remember how reliably. However, I'm not sure that's what you want here. The goal is to show the optimiser itself, plus a few numbers of its state (to see if all zero), and that doesn't depend on window size.

If there were always an outermost struct this package owned, then that could arrange to only print one screenful, like matrix printing does. But there isn't right now.

Copy link
Member

Choose a reason for hiding this comment

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

I noticed that display for arrays can insert the ... in the middle instead of cutting things off at the end based on terminal width. Is there a way to do this but with a custom width like the one specified here?

@mcabbott mcabbott added the enhancement New feature or request label Mar 23, 2022
@mcabbott mcabbott mentioned this pull request Oct 13, 2022
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants