Skip to content

Commit

Permalink
clip strings that are too long when showing IDSs
Browse files Browse the repository at this point in the history
  • Loading branch information
orso82 committed Jan 16, 2025
1 parent dd84f9d commit f3f6e22
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ function AbstractTrees.printnode(io::IO, node_value::IMASnodeRepr)
printstyled(io, "Function"; color)
elseif typeof(value) <: String
color = :magenta
printstyled(io, "\"$(value)\""; color)
if length(value) < 80
printstyled(io, "\"$(value)\""; color)
else
printstyled(io, "\"$(value[1:30])"; color)
printstyled(io, " ...$(length(value)) chars... "; color, bold=true)
printstyled(io, "$(value[end-30:end])\""; color)
end
elseif typeof(value) <: Integer
color = :yellow
printstyled(io, "$(value)"; color)
Expand Down

0 comments on commit f3f6e22

Please sign in to comment.