From e8a6af086c54a27506de0335a10ad11621524f6f Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Wed, 30 Oct 2019 16:38:29 +0100 Subject: [PATCH] Using cancelOperation: since this is called by pressing the Esc key. --- MacPass/MPToolbarDelegate.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MacPass/MPToolbarDelegate.m b/MacPass/MPToolbarDelegate.m index 0cd055e3..ea214ed6 100644 --- a/MacPass/MPToolbarDelegate.m +++ b/MacPass/MPToolbarDelegate.m @@ -238,16 +238,18 @@ NSString *const MPToolbarItemAutotype = @"TOOLBAR_AUTOTYPE"; #pragma mark - NSSearchFieldDelegate - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector { + if(control != self.searchField) { + return NO; + } if(commandSelector == @selector(insertNewline:) || commandSelector == @selector(moveDown:)) { /* Dispatch the focus loss since doing it now will break recent search storage */ dispatch_async(dispatch_get_main_queue(), ^{ [[NSApp targetForAction:@selector(focusEntries:) to:nil from:self] focusEntries:self]; }); } - if(commandSelector == @selector(cancel:) && control == self.searchField) { + if(commandSelector == @selector(cancelOperation:) ) { dispatch_async(dispatch_get_main_queue(), ^{ - NSSearchFieldCell *cell = self.searchField.cell; - [[NSApp targetForAction:cell.cancelButtonCell.action to:nil from:self] exitSearch:nil]; + [[NSApp targetForAction:@selector(exitSearch:) to:nil from:self] exitSearch:nil]; }); } return NO;