UnicodePlots: fixes
This commit is contained in:
parent
31d33e6be4
commit
1a1cc08992
@ -173,10 +173,10 @@ function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
|
|||||||
nr, nc = size(plt.layout)
|
nr, nc = size(plt.layout)
|
||||||
lines_colored = Array{Union{Nothing,Vector{String}}}(undef, nr, nc)
|
lines_colored = Array{Union{Nothing,Vector{String}}}(undef, nr, nc)
|
||||||
lines_uncolored = copy(lines_colored)
|
lines_uncolored = copy(lines_colored)
|
||||||
|
l_max = zeros(Int, nr)
|
||||||
buf = IOBuffer()
|
buf = IOBuffer()
|
||||||
cbuf = IOContext(buf, :color => true)
|
cbuf = IOContext(buf, :color => true)
|
||||||
sps = wmax = 0
|
sps = wmax = 0
|
||||||
l_max = zeros(Int, nr)
|
|
||||||
for r in 1:nr
|
for r in 1:nr
|
||||||
lmax = 0
|
lmax = 0
|
||||||
for c in 1:nc
|
for c in 1:nc
|
||||||
@ -200,16 +200,17 @@ function _show(io::IO, ::MIME"text/plain", plt::Plot{UnicodePlotsBackend})
|
|||||||
end
|
end
|
||||||
l_max[r] = lmax
|
l_max[r] = lmax
|
||||||
end
|
end
|
||||||
|
empty = ' '^wmax
|
||||||
for r in 1:nr
|
for r in 1:nr
|
||||||
for n in 1:l_max[r]
|
for n in 1:l_max[r]
|
||||||
for c in 1:nc
|
for c in 1:nc
|
||||||
pre = c == 1 ? '' : ' '
|
pre = c == 1 ? '\0' : ' '
|
||||||
if (lc = lines_colored[r, c]) !== nothing
|
lc = lines_colored[r, c]
|
||||||
length(lc) < n && continue
|
if lc === nothing || length(lc) < n
|
||||||
|
print(io, pre, empty)
|
||||||
|
else
|
||||||
lu = lines_uncolored[r, c]
|
lu = lines_uncolored[r, c]
|
||||||
print(io, pre, lc[n], ' '^(wmax - length(lu[n])))
|
print(io, pre, lc[n], ' '^(wmax - length(lu[n])))
|
||||||
else
|
|
||||||
print(io, pre, ' '^wmax)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
println(io)
|
println(io)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user