Fix deleting previously selected torrent when trying to clear search field using Command + Delete (#4245)

* Fix deleting previously selected torrent when trying to clear search field using Command + Delete

Fixes #3599

* Fixes after code review

* Fixes after code review

* chore: make clang-format happy

Co-authored-by: Daniil Subbotin <d.subbotin@opends.tech>
This commit is contained in:
Daniil Subbotin
2022-11-28 07:31:26 +03:00
committed by GitHub
parent 0ee93068bb
commit 9a6fbc9ced
3 changed files with 13 additions and 0 deletions

View File

@@ -264,6 +264,13 @@ typedef NS_ENUM(NSInteger, FilterTypeTag) {
[self.view.window makeFirstResponder:self.fSearchField];
}
- (BOOL)isFocused
{
NSTextView* textView = (NSTextView*)self.fSearchField.window.firstResponder;
return [self.fSearchField.window.firstResponder isKindOfClass:NSTextView.class] &&
[self.fSearchField.window fieldEditor:NO forObject:nil] != nil && [self.fSearchField isEqualTo:textView.delegate];
}
- (void)searchFieldDidStartSearching:(NSSearchField*)sender
{
[self.fSearchFieldMinWidthConstraint animator].constant = 95;