Skip to content

Commit c198f70

Browse files
committed
shorten leaf printing
1 parent adc0e85 commit c198f70

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/interface.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,11 @@ onevalue(λ, x::AbstractArray{T}) where T = onevalue(convert(float(T), λ), x)
116116

117117
function Base.show(io::IO, ℓ::Leaf) # show method is mostly to hide its long type!
118118
ioc = IOContext(io, :compact => true)
119-
print(ioc, "Leaf(", ℓ.rule, ", ")
120-
show(ioc, ℓ.state)
121-
print(io, ")")
119+
printstyled(io, "Leaf("; color = :green)
120+
show(ioc, ℓ.rule)
121+
printstyled(", "; color = :green)
122+
str = sprint(show, ℓ.state; context = ioc)
123+
print(io, length(str) < 70 ? str : first(str, 50) * "")
124+
printstyled(io, ")"; color = :green)
122125
end
123126

0 commit comments

Comments
 (0)