From 80178813963e5d37975496e0030b78977f1e400c Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Mon, 4 Nov 2024 00:04:53 +0100 Subject: [PATCH] fix show for zero dim array val (#838) --- src/Dimensions/show.jl | 5 +++-- test/show.jl | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Dimensions/show.jl b/src/Dimensions/show.jl index e7de881a5..fc8b2039b 100644 --- a/src/Dimensions/show.jl +++ b/src/Dimensions/show.jl @@ -118,9 +118,10 @@ function print_dimval(io, mime, val, nchars=0) val isa Colon || print(io, " ") printstyled(io, val; color=get(io, :dimcolor, 1)) end -function print_dimval(io, mime, lookup::AbstractArray, nchars=0) +print_dimval(io, mime, lookup::AbstractArray, nchars=0) = Lookups.print_index(io, mime, lookup, nchars) -end +print_dimval(io, mime, lookup::AbstractArray{<:Any,0}, nchars=0) = + printstyled(io, " ", lookup; color=get(io, :dimcolor, 1)) print_dimval(io, mime, lookup::Union{AutoLookup,AbstractNoLookup}, nchars=0) = print(io, "") function print_dimval(io, mime, lookup::Lookup, nchars=0) print(io, " ") diff --git a/test/show.jl b/test/show.jl index 40a7aa2d0..2a2df0a98 100644 --- a/test/show.jl +++ b/test/show.jl @@ -63,6 +63,10 @@ end @testset "dims" begin sv = sprint(show, MIME("text/plain"), X()) @test occursin("X", sv) + sv = sprint(show, MIME("text/plain"), X(fill(0))) + @test occursin("X", sv) + sv = sprint(show, MIME("text/plain"), X(1:5)) + @test occursin("X", sv) end @testset "show lookups" begin