diff --git a/CHANGELOG.md b/CHANGELOG.md index 48a5cc4e9..01b524203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unreleased - Added ability to return `ProcessedLayers` from transformations, thereby enabling multi-layer transformations, such as scatter plus errorbars [#549](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/549). +- Fixed bug where `mergesorted` applied on string vectors used `isless` instead of natural sort [#553](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/553). ## v0.8.6 - 2024-09-02 diff --git a/src/scales.jl b/src/scales.jl index 2073a2812..5f670db7c 100644 --- a/src/scales.jl +++ b/src/scales.jl @@ -493,7 +493,7 @@ function mergesorted(v1, v2) v = sizehint!(T[], length(v1) + length(v2)) i1, i2 = 1, 1 while i2 ≤ length(v2) - while i1 ≤ length(v1) && isless(v1[i1], v2[i2]) + while i1 ≤ length(v1) && natural_lt(v1[i1], v2[i2]) push_different!(v, v1[i1]) i1 += 1 end diff --git a/test/utils.jl b/test/utils.jl index 1ea848786..cc04f9488 100644 --- a/test/utils.jl +++ b/test/utils.jl @@ -11,6 +11,10 @@ @test AlgebraOfGraphics.extend_extrema(e1, e2) == (-5, 11) @test AlgebraOfGraphics.midpoints(1:10) == 1.5:9.5 + + # issue 552 + v = ["1", "9", "10"] + @test AlgebraOfGraphics.mergesorted(v, v) == v end @testset "arguments" begin