Skip to content

Commit 74d9276

Browse files
committed
remove newlines in :compact printing
1 parent bbeb8e5 commit 74d9276

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/tensors/abstracttensor.jl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -645,18 +645,24 @@ end
645645

646646
# Human-readable:
647647
function Base.show(io::IO, ::MIME"text/plain", t::AbstractTensorMap)
648-
# 1) show summary: typically d₁×d₂×… ← d₃×d₄×… $(typeof(t)):
648+
# 1) show summary: typically d₁×d₂×… ← d₃×d₄×… $(typeof(t))
649649
summary(io, t)
650-
println(io, ":")
651650

651+
# case without `\n`:
652+
if get(io, :compact, true)
653+
print(io, "(…, ")
654+
show(io, mime, space(t))
655+
print(io, ')')
656+
return nothing
657+
end
658+
659+
# case with `\n`
652660
# 2) show spaces
653-
# println(io, " space(t):")
661+
println(io, ':')
654662
println(io, " codomain: ", codomain(t))
655663
println(io, " domain: ", domain(t))
656664

657665
# 3) [optional]: show data
658-
get(io, :compact, true) && return nothing
659-
ioc = IOContext(io, :typeinfo => sectortype(t))
660666
println(io, "\n\n blocks: ")
661667
show_blocks(io, MIME"text/plain"(), blocks(t))
662668
return nothing

0 commit comments

Comments
 (0)