mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
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:
parent
0ee93068bb
commit
9a6fbc9ced
3 changed files with 13 additions and 0 deletions
|
@ -4772,6 +4772,11 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
|
|||
{
|
||||
BOOL warning = NO;
|
||||
|
||||
if (self.fFilterBar.isFocused == YES)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
for (Torrent* torrent in self.fTableView.selectedTorrents)
|
||||
{
|
||||
if (torrent.active)
|
||||
|
|
|
@ -33,6 +33,7 @@ extern const NSInteger kGroupFilterAllTag;
|
|||
- (IBAction)setGroupFilter:(id)sender;
|
||||
- (void)reset:(BOOL)updateUI;
|
||||
- (void)focusSearchField;
|
||||
- (BOOL)isFocused;
|
||||
|
||||
- (void)setCountAll:(NSUInteger)all
|
||||
active:(NSUInteger)active
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue