@@ -50,7 +50,7 @@ @implementation GIAdvancedCommitViewController {
50
50
51
51
#pragma mark - Search
52
52
- (void )setupSearch {
53
- [ NSNotificationCenter .defaultCenter addObserver: self selector: @selector ( textDidChange: ) name: NSTextDidChangeNotification object: nil ] ;
53
+ self. searchTextField . delegate = self ;
54
54
self.searchTextField .nextKeyView = self.messageTextView ;
55
55
self.searchTextField .nextResponder = self.messageTextView ;
56
56
}
@@ -60,17 +60,16 @@ - (void)resetSearch {
60
60
[self .repository updateFilePattern: nil ];
61
61
}
62
62
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
+ }
74
73
}
75
74
}
76
75
@@ -131,10 +130,6 @@ - (void)viewWillDisappear {
131
130
[self resetSearch ];
132
131
}
133
132
134
- - (void )dealloc {
135
- [self unsetSearch ];
136
- }
137
-
138
133
#pragma mark - Repository Handling
139
134
- (void )repositoryStatusDidUpdate {
140
135
[super repositoryStatusDidUpdate ];
0 commit comments