Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cocoa GUI: Fix unsorted streams in compare view #800

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading