Skip to content

Commit 97485cb

Browse files
committed
kit: advanced commit view controller search field bugs have been fixed.
1 parent 22bd7b1 commit 97485cb

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

GitUpKit/Views/Base.lproj/GIAdvancedCommitViewController.xib

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@
146146
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
147147
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
148148
</searchFieldCell>
149-
<connections>
150-
<outlet property="nextKeyView" destination="ZGk-oR-MNP" id="iik-md-9MI"/>
151-
</connections>
152149
</searchField>
153150
</subviews>
154151
<constraints>

GitUpKit/Views/GIAdvancedCommitViewController.m

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)