Skip to content

Commit

Permalink
Merge pull request #800 from g-maxime/compare-order
Browse files Browse the repository at this point in the history
Cocoa GUI: Fix unsorted streams in compare view
  • Loading branch information
JeromeMartinez authored Feb 12, 2024
2 parents 2785946 + 69c24da commit 45aa301
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Source/GUI/Cocoa/CompareView.m
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,17 @@ -(id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)
}
}
}
else {
if (index < [_fields count])
return [[_fields allKeys] objectAtIndex: index];
else if (index < [_fields count]) {
return [[[_fields allKeys] sortedArrayUsingComparator:^NSComparisonResult(id first, id second) {
if ([first[@"kind"] isLessThan: second[@"kind"]] || ([first[@"kind"] isEqualTo: second[@"kind"]] && [first[@"number"] isLessThan: second[@"number"]])) {
return NSOrderedAscending;
}
if ([first[@"kind"] isGreaterThan: second[@"kind"]] || ([first[@"kind"] isEqualTo: second[@"kind"]] && [first[@"number"] isGreaterThan: second[@"number"]])) {
return NSOrderedDescending;
}

return NSOrderedSame;
}] objectAtIndex:index];
}

return nil;
Expand Down

0 comments on commit 45aa301

Please sign in to comment.