Skip to content

Commit

Permalink
avoid reloading directory when undoing move/trash
Browse files Browse the repository at this point in the history
  • Loading branch information
gobbledegook committed Dec 14, 2023
1 parent abd581c commit f550fdd
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions CreeveyMainWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,17 @@ - (void)fileWasDeleted:(NSString *)s atIndex:(NSUInteger)i {

- (void)filesWereUndeleted:(NSArray *)a {
NSString *currentPath = self.path;
BOOL needsRefresh = NO;
BOOL subfolders = self.wantsSubfolders;
for (NSString *s in a) {
if ([s hasPrefix:currentPath])
needsRefresh = YES;
if (subfolders ? [s hasPrefix:currentPath] : [s.stringByDeletingLastPathComponent isEqualToString:currentPath])
dispatch_async(dispatch_get_main_queue(), ^{
if (!filenamesDone) return;
NSUInteger count = filenames.count;
NSUInteger idx = [filenames indexOfObject:s inSortedRange:NSMakeRange(0, count) options:NSBinarySearchingInsertionIndex usingComparator:self.comparator];
if (idx == count || ![filenames[idx] isEqualToString:s])
[self addFile:s atIndex:idx];
});
}
if (needsRefresh)
[self setPath:currentPath];
}

- (void)updateStatusFld {
Expand Down

0 comments on commit f550fdd

Please sign in to comment.