@@ -50,7 +50,7 @@ @implementation GIAdvancedCommitViewController {
5050
5151#pragma mark - Search
5252- (void )setupSearch {
53- [ NSNotificationCenter .defaultCenter addObserver: self selector: @selector ( textDidChange: ) name: NSTextDidChangeNotification object: nil ] ;
53+ self. searchTextField . delegate = self ;
5454 self.searchTextField .nextKeyView = self.messageTextView ;
5555 self.searchTextField .nextResponder = self.messageTextView ;
5656}
@@ -60,17 +60,16 @@ - (void)resetSearch {
6060 [self .repository updateFilePattern: nil ];
6161}
6262
63- - (void )unsetSearch {
64- [NSNotificationCenter .defaultCenter removeObserver: self ];
65- }
66-
67- - (void )textDidChange : (NSNotification *)notification {
68- NSString *text = self.searchTextField .stringValue ;
69- if ([@" " isEqualToString: text]) {
70- [self .repository updateFilePattern: nil ];
71- }
72- else {
73- [self .repository updateFilePattern: text];
63+ #pragma mark - NSControlTextEditingDelegate
64+ - (void )controlTextDidChange : (NSNotification *)obj {
65+ if (obj.object == self.searchTextField ) {
66+ NSString *text = self.searchTextField .stringValue ;
67+ if ([@" " isEqualToString: text]) {
68+ [self .repository updateFilePattern: nil ];
69+ }
70+ else {
71+ [self .repository updateFilePattern: text];
72+ }
7473 }
7574}
7675
@@ -131,10 +130,6 @@ - (void)viewWillDisappear {
131130 [self resetSearch ];
132131}
133132
134- - (void )dealloc {
135- [self unsetSearch ];
136- }
137-
138133#pragma mark - Repository Handling
139134- (void )repositoryStatusDidUpdate {
140135 [super repositoryStatusDidUpdate ];
0 commit comments