Fixed #945 Cancel search mode while the search field is empty (#946)

This commit is contained in:
Oleksandr Yakubchyk
2019-10-30 17:02:06 +02:00
committed by Michael Starke
parent 6897f9e51c
commit 631741d30b

View File

@@ -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;
}