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

Don't bold model name etc in show #2576

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
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 @@

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
Loading