Skip to content

Commit

Permalink
shorten leaf printing
Browse files Browse the repository at this point in the history
  • Loading branch information
mcabbott committed Feb 5, 2022
1 parent adc0e85 commit c198f70
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ onevalue(λ, x::AbstractArray{T}) where T = onevalue(convert(float(T), λ), x)

function Base.show(io::IO, ℓ::Leaf) # show method is mostly to hide its long type!
ioc = IOContext(io, :compact => true)
print(ioc, "Leaf(", ℓ.rule, ", ")
show(ioc, ℓ.state)
print(io, ")")
printstyled(io, "Leaf("; color = :green)
show(ioc, ℓ.rule)
printstyled(", "; color = :green)
str = sprint(show, ℓ.state; context = ioc)
print(io, length(str) < 70 ? str : first(str, 50) * "")
printstyled(io, ")"; color = :green)
end

0 comments on commit c198f70

Please sign in to comment.