Skip to content

Commit

Permalink
Don't bold model name etc in show
Browse files Browse the repository at this point in the history
  • Loading branch information
oxinabox committed Apr 9, 2024
1 parent 9b1d432 commit 831039d
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/systems/abstractsystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1233,16 +1233,21 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem)
nvars = length(vars)
if eqs isa AbstractArray && eltype(eqs) <: Equation
neqs = count(eq -> !(eq.lhs isa Connection), eqs)
Base.printstyled(io, "Model $(nameof(sys)) with $neqs "; bold = true)
Base.printstyled(io, "Model "; bold = true)
Base.print(io, nameof(sys))
Base.printstyled(io, " with "; bold = true)
Base.print(io, neqs, " ")

nextras = n_extra_equations(sys)
if nextras > 0
Base.printstyled(io, "("; bold = true)
Base.printstyled(io, neqs + nextras; bold = true, color = :magenta)
Base.printstyled(io, neqs + nextras; color = :magenta)
Base.printstyled(io, ") "; bold = true)
end
Base.printstyled(io, "equations\n"; bold = true)
else
Base.printstyled(io, "Model $(nameof(sys))\n"; bold = true)
Base.printstyled(io, "Model "; bold = true)
Base.println(io, nameof(sys))

Check warning on line 1250 in src/systems/abstractsystem.jl

View check run for this annotation

Codecov / codecov/patch

src/systems/abstractsystem.jl#L1249-L1250

Added lines #L1249 - L1250 were not covered by tests
end
# The reduced equations are usually very long. It's not that useful to print
# them.
Expand All @@ -1252,7 +1257,9 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem)
rows = first(displaysize(io)) ÷ 5
limit = get(io, :limit, false)

Base.printstyled(io, "Unknowns ($nvars):"; bold = true)
Base.printstyled(io, "Unknowns ("; bold = true)
Base.print(io, nvars)
Base.printstyled(io, "):"; bold = true)
nrows = min(nvars, limit ? rows : nvars)
limited = nrows < length(vars)
defs = has_defaults(sys) ? defaults(sys) : nothing
Expand Down Expand Up @@ -1281,7 +1288,9 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem)

vars = parameters(sys)
nvars = length(vars)
Base.printstyled(io, "Parameters ($nvars):"; bold = true)
Base.printstyled(io, "Parameters ("; bold = true)
Base.print(io, nvars)
Base.printstyled(io, "):"; bold = true)
nrows = min(nvars, limit ? rows : nvars)
limited = nrows < length(vars)
for i in 1:nrows
Expand Down

0 comments on commit 831039d

Please sign in to comment.