From 760a25e88f91d74b8d2633dc87d8557e7a9aa475 Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Wed, 22 Aug 2018 12:21:00 +0200 Subject: [PATCH] Fixed regression resulting in no recent searches being stored. This was introduced by adding better search filed keyboard navigation in 92c83e0 --- MacPass/MPToolbarDelegate.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MacPass/MPToolbarDelegate.m b/MacPass/MPToolbarDelegate.m index 8a201895..6619b63f 100644 --- a/MacPass/MPToolbarDelegate.m +++ b/MacPass/MPToolbarDelegate.m @@ -175,6 +175,7 @@ NSString *const MPToolbarItemAutotype = @"TOOLBAR_AUTOTYPE"; item.maxSize = NSMakeSize(240, 32); NSMenu *templateMenu = [self _allocateSearchMenuTemplate]; searchField.searchMenuTemplate = templateMenu; + /* 10.10 does not support NSSearchFieldDelegate */ ((NSTextField *)searchField).delegate = self; self.searchField = searchField; } @@ -232,7 +233,10 @@ NSString *const MPToolbarItemAutotype = @"TOOLBAR_AUTOTYPE"; #pragma mark - NSSearchFieldDelegate - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector { if(commandSelector == @selector(insertNewline:) || commandSelector == @selector(moveDown:)) { - [[NSApp targetForAction:@selector(focusEntries:) to:nil from:self] focusEntries:self]; + /* 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]; + }); } return NO; }