Skip to content

Commit e932bef

Browse files
authored
Fix mergesorted bug (#553)
1 parent 4834dea commit e932bef

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- 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).
6+
- Fixed bug where `mergesorted` applied on string vectors used `isless` instead of natural sort [#553](https://github.com/MakieOrg/AlgebraOfGraphics.jl/pull/553).
67

78
## v0.8.6 - 2024-09-02
89

src/scales.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ function mergesorted(v1, v2)
493493
v = sizehint!(T[], length(v1) + length(v2))
494494
i1, i2 = 1, 1
495495
while i2 length(v2)
496-
while i1 length(v1) && isless(v1[i1], v2[i2])
496+
while i1 length(v1) && natural_lt(v1[i1], v2[i2])
497497
push_different!(v, v1[i1])
498498
i1 += 1
499499
end

test/utils.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
@test AlgebraOfGraphics.extend_extrema(e1, e2) == (-5, 11)
1212

1313
@test AlgebraOfGraphics.midpoints(1:10) == 1.5:9.5
14+
15+
# issue 552
16+
v = ["1", "9", "10"]
17+
@test AlgebraOfGraphics.mergesorted(v, v) == v
1418
end
1519

1620
@testset "arguments" begin

0 commit comments

Comments
 (0)