Fixed missing selection update, when search yields results

This commit is contained in:
Michael Starke 2021-10-29 14:21:11 +02:00
parent fb27d330d6
commit 05d4381045
1 changed files with 3 additions and 2 deletions

View File

@ -409,7 +409,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
return; // Not the right table view return; // Not the right table view
} }
/* do not update the current item if we are not in focus! */ /* do not update the current item if we are not in focus! */
if(tableView.window.firstResponder == self.entryTable) { if(self.displayMode == MPDisplayModeSearchResults || tableView.window.firstResponder == self.entryTable) {
MPDocument *document = self.windowController.document; MPDocument *document = self.windowController.document;
document.selectedEntries = self.entryArrayController.selectedObjects; document.selectedEntries = self.entryArrayController.selectedObjects;
} }
@ -509,7 +509,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
- (void)_didUpdateSearchResults:(NSNotification *)notification { - (void)_didUpdateSearchResults:(NSNotification *)notification {
NSArray *result = notification.userInfo[kMPDocumentSearchResultsKey]; NSArray *result = notification.userInfo[kMPDocumentSearchResultsKey];
NSAssert(result != nil, @"Resutls should never be nil"); NSAssert(result != nil, @"Results should never be nil");
self.filteredEntries = result; self.filteredEntries = result;
self.entryArrayController.content = self.filteredEntries; self.entryArrayController.content = self.filteredEntries;
[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier].hidden = NO; [self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier].hidden = NO;
@ -529,6 +529,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
- (void)_didEnterSearch:(NSNotification *)notification { - (void)_didEnterSearch:(NSNotification *)notification {
self.displayMode = MPDisplayModeSearchResults; self.displayMode = MPDisplayModeSearchResults;
// FIXME: update selection?
[self _updateContextBar]; [self _updateContextBar];
} }