Skip to content

Commit

Permalink
fix show for zero dim array val (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz authored Nov 3, 2024
1 parent 8763934 commit 8017881
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Dimensions/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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, " ")
Expand Down
4 changes: 4 additions & 0 deletions test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8017881

Please sign in to comment.