Skip to content

Commit 835d445

Browse files
kescobotimholy
authored andcommitted
Use ReshapedArray for show() (#329)
1 parent bc72215 commit 835d445

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/display.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ function Base.show(io::IO, ::MIME"image/svg+xml", c::Color)
1919
""")
2020
end
2121

22-
function Base.show(io::IO, ::MIME"image/svg+xml",
22+
function Base.show(io::IO, ::MIME"image/svg+xml",
2323
cs::AbstractVector{T}) where T <: Color
24-
show(io, MIME"image/svg+xml"(), reshape(cs, (1, length(cs))))
24+
show(io, MIME"image/svg+xml"(), Base.ReshapedArray(cs, (1, length(cs)), ()))
2525
end
2626

2727
function Base.show(io::IO, ::MIME"image/svg+xml",

test/colormaps.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
@testset "Colormaps" begin
22
@test length(colormap("RdBu", 100)) == 100
3+
4+
# test ability to add to previously shown array of colors - issue #328
5+
a = [colorant"white", colorant"red"]
6+
show(stdout, MIME"image/svg+xml"(), a)
7+
push!(a, colorant"blue")
8+
@test length(a) == 3
39
end

0 commit comments

Comments
 (0)