Skip to content

Commit ed4432f

Browse files
committed
Limit number of subsystems shown
1 parent 79db00d commit ed4432f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/systems/abstractsystem.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1896,8 +1896,10 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = t
18961896
# Print subsystems
18971897
subs = sys.systems
18981898
nsubs = length(subs)
1899-
nsubs > 0 && printstyled(io, "\nSubsystems ($(nsubs)): "; bold)
1900-
for sub in subs
1899+
nrows = min(nsubs, limit ? rows : nsubs)
1900+
nrows > 0 && printstyled(io, "\nSubsystems ($(nsubs)): "; bold)
1901+
for i in 1:nrows
1902+
sub = subs[i]
19011903
name = String(nameof(sub))
19021904
print(io, "\n ", name)
19031905
desc = get_description(sub)
@@ -1909,6 +1911,8 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = t
19091911
print(io, ": ", desc)
19101912
end
19111913
end
1914+
limited = nrows < nsubs
1915+
limited && print(io, "\n") # too many variables to print
19121916

19131917
# Print equations
19141918
eqs = equations(sys)
@@ -1954,7 +1958,7 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = t
19541958
print(io, ": ", desc)
19551959
end
19561960
end
1957-
limited = nrows < length(vars)
1961+
limited = nrows < nvars
19581962
limited && print(io, "\n") # too many variables to print
19591963
end
19601964

0 commit comments

Comments
 (0)