Skip to content

Commit

Permalink
rework display
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bltg committed Sep 2, 2022
1 parent 1bc2281 commit 054cd1e
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,15 @@ function __init__()
InspectDRBackend,
GastonBackend,
)
# showable(MIME("image/png"), Plot{be}) || continue # will only work for currently loaded backends
@eval function _display(plt::Plot{$be})
I = findfirst(
d -> d isa ImageInTerminal.TerminalGraphicDisplay,
Base.Multimedia.displays,
)
dsp = if I === nothing
ImageInTerminal.TerminalGraphicDisplay(stdout)
else
Base.Multimedia.displays[I]
end
buf = IOBuffer()
@eval function Base.display(::PlotsDisplay, plt::Plot{$be})
prepare_output(plt)
buf = PipeBuffer()
show(buf, MIME("image/png"), plt)
display(dsp, MIME("image/png"), take!(buf))
display(
ImageInTerminal.TerminalGraphicDisplay(stdout),
MIME("image/png"),
read(buf),
)
end
end
end
Expand Down

0 comments on commit 054cd1e

Please sign in to comment.