Skip to content

Commit b380865

Browse files
authored
simplification (#367)
1 parent e095b36 commit b380865

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/common.jl

+1-2
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,10 @@ extend_limits(vec, lims) = extend_limits(vec, lims, :identity)
439439
unitless(x) = x # noop when Unitful is not loaded
440440

441441
function extend_limits(vec::AbstractVector, lims, scale::Union{Symbol,Function})
442-
isempty(vec) && return is_auto(lims) ? autolims(lims) : lims
443-
444442
scale = scale_callback(scale)
445443
mi, ma = as_float(extrema(lims))
446444
if iszero(mi) && iszero(ma)
445+
isempty(vec) && return is_auto(lims) ? autolims(lims) : lims
447446
mi, ma = as_float(extrema(vec))
448447
end
449448
if mi == ma

test/tst_common.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ end
3636
@test UnicodePlots.extend_limits([1, 2, 3, 4], [0, 0]) (1.0, 4.0)
3737
@test UnicodePlots.extend_limits([1, 2, 3, 4], [1, 1]) (0.0, 2.0)
3838

39-
@test UnicodePlots.extend_limits([], (-1, 2)) (-1, 2)
39+
@test UnicodePlots.extend_limits([], (-1, 2)) (-1.0, 2.0)
4040

4141
@test UnicodePlots.is_auto((0, 0))
4242
@test UnicodePlots.is_auto([0, 0])

test/tst_io.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ end
8282
end
8383

8484
@testset "Term extension" begin
85-
gridplot(map(i -> lineplot((-i):i), 1:5); show_placeholder = true) |> display
86-
gridplot(map(i -> lineplot((-i):i), 1:3); layout = (2, nothing)) |> display
87-
gridplot(map(i -> lineplot((-i):i), 1:3); layout = (nothing, 1)) |> display
85+
show(devnull, gridplot(map(i -> lineplot((-i):i), 1:5); show_placeholder = true))
86+
show(devnull, gridplot(map(i -> lineplot((-i):i), 1:3); layout = (2, nothing)))
87+
show(devnull, gridplot(map(i -> lineplot((-i):i), 1:3); layout = (nothing, 1)))
8888
end

0 commit comments

Comments
 (0)