From 22acd31b25c61997d24410e8933d943aba4e9f47 Mon Sep 17 00:00:00 2001 From: Allan Odgaard Date: Thu, 23 Jul 2015 13:13:09 +0200 Subject: [PATCH] Skip reloading file browser items if items are unchanged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The comparison is somewhat shallow, but ideally all changes to the actual items (rather than adding or removing items) is done by updating the properties of the existing instance. The exception here is the SCM Status data source, but FSItem’s isEqual: method does compare scmStatus. --- Frameworks/OakFileBrowser/src/FSOutlineViewDelegate.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Frameworks/OakFileBrowser/src/FSOutlineViewDelegate.mm b/Frameworks/OakFileBrowser/src/FSOutlineViewDelegate.mm index c2e665e6..8eeeac59 100644 --- a/Frameworks/OakFileBrowser/src/FSOutlineViewDelegate.mm +++ b/Frameworks/OakFileBrowser/src/FSOutlineViewDelegate.mm @@ -432,9 +432,8 @@ struct expansion_state_t ++state->requests; [_dataSource reloadItem:item completionHandler:^(NSArray* children){ - // The reason we continue even with no changes is that icon updates (SCM status) are not reflected by `hasChanges` BOOL hasChanges = !item.children || ![item.children isEqualToArray:children]; - if(!state->stop && ([_outlineView editedRow] == -1 || hasChanges)) + if(!state->stop && hasChanges) { NSIndexSet* indexSet = [_outlineView selectedRowIndexes]; for(NSUInteger index = [indexSet firstIndex]; index != NSNotFound; index = [indexSet indexGreaterThanIndex:index])