From 631741d30b87abb8040a7974a8361c5278b27cdf Mon Sep 17 00:00:00 2001 From: Oleksandr Yakubchyk Date: Wed, 30 Oct 2019 17:02:06 +0200 Subject: [PATCH] Fixed #945 Cancel search mode while the search field is empty (#946) --- MacPass/MPToolbarDelegate.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MacPass/MPToolbarDelegate.m b/MacPass/MPToolbarDelegate.m index 098ef5b0..372758b0 100644 --- a/MacPass/MPToolbarDelegate.m +++ b/MacPass/MPToolbarDelegate.m @@ -244,6 +244,12 @@ NSString *const MPToolbarItemAutotype = @"TOOLBAR_AUTOTYPE"; [[NSApp targetForAction:@selector(focusEntries:) to:nil from:self] focusEntries:self]; }); } + if(commandSelector == @selector(cancel:) && control == self.searchField) { + dispatch_async(dispatch_get_main_queue(), ^{ + NSSearchFieldCell *cell = self.searchField.cell; + [[NSApp targetForAction:cell.cancelButtonCell.action to:nil from:self] exitSearch:nil]; + }); + } return NO; }