Skip to content

Commit 2d414fb

Browse files
authored
Query for the text search field's value whenever it is changed to work around an invalid behaviour of the Find Files dialog. Tentetively fixed #482 (#487)
1 parent 16f614a commit 2d414fb

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Source/NimbleCommander/NimbleCommander/States/FilePanels/FindFilesSheetController.mm

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,21 @@ - (void)comboBoxWillDismiss:(NSNotification *) [[maybe_unused]] notification
690690
dispatch_to_main_queue_after(10ms, [=] { [self setupReturnKey]; });
691691
}
692692

693-
- (void)controlTextDidChange:(NSNotification *)obj
693+
- (void)controlTextDidChange:(NSNotification *)_notification
694694
{
695-
[self onSearchSettingsUIChanged:obj.object];
695+
if( nc::objc_cast<NSTextField>(_notification.object) == self.textSearchField ) {
696+
// For some reason when:
697+
// 1) the Enabled property of this text field is bound; AND
698+
// 2) the listener of this notification does not query the string value. THEN
699+
// => the value of `self.textSearchField.stringValue` is not updated upon a mouse click on the Search button
700+
// and later, once the text field is disabled, the field editor discards the input completely.
701+
// To work around this bug, let's query the value just for the sake of it.
702+
// This situation doesn't make much sense and a proper fix with a better understanding is required.
703+
// See the GitHub issue #482 for details.
704+
(void)self.textSearchField.stringValue;
705+
}
706+
707+
[self onSearchSettingsUIChanged:_notification.object];
696708
}
697709

698710
- (IBAction)onSearchSettingsUIChanged:(id) [[maybe_unused]] sender

0 commit comments

Comments
 (0)