@@ -232,7 +232,8 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
232
232
{
233
233
if ([(NSString *)context isEqualToString: @" commitChange" ]) {
234
234
[self updateKeys ];
235
- // [self restoreFileBrowserSelection];
235
+ [self restoreFileBrowserSelection ];
236
+ [self updateSearch: filesSearchField];
236
237
}else if ([(NSString *)context isEqualToString: @" treeChange" ]) {
237
238
[self updateQuicklookForce: NO ];
238
239
[self saveFileBrowserSelection ];
@@ -811,6 +812,32 @@ - (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(PBSourceViewCe
811
812
NSImage *image = [workspace iconForFile: path];
812
813
[image setSize: NSMakeSize (15 , 15 )];
813
814
[cell setImage: image];
815
+
816
+ NSColor *textColor = [NSColor blackColor ];
817
+ if ([object filterPredicate ] && !([[filesSearchField stringValue ] length ] > 0 && [[object filterPredicate ] evaluateWithObject: object])) {
818
+ textColor = [NSColor lightGrayColor ];
819
+ }
820
+
821
+
822
+ [cell setTextColor: textColor];
823
+ }
824
+
825
+ #pragma mark -
826
+
827
+ - (IBAction ) updateSearch : (NSSearchField *) sender {
828
+ static NSPredicate *predicateTemplate = nil ;
829
+ if (!predicateTemplate) {
830
+ predicateTemplate = [NSPredicate predicateWithFormat: @" path CONTAINS [c] $SEARCH_STRING" ];
831
+ }
832
+
833
+ NSString *searchString = [sender stringValue ];
834
+ NSPredicate *predicate = nil ;
835
+ if ([searchString length ] > 0 ) {
836
+ predicate = [predicateTemplate predicateWithSubstitutionVariables:
837
+ [NSDictionary dictionaryWithObject: searchString forKey: @" SEARCH_STRING" ]];
838
+ }
839
+ [gitTree setFilterPredicate: predicate];
840
+ [treeController setContent: gitTree.filteredChildren];
814
841
}
815
842
816
843
@end
0 commit comments