Skip to content

Commit d364d89

Browse files
committed
Enable ⌘(F)(G)(ꜛG), to find in commit list
1 parent 74a6508 commit d364d89

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

Classes/Controllers/PBGitHistoryController.m

+9
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ - (void)awakeFromNib
100100
// listen for updates
101101
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_repositoryUpdatedNotification:) name:PBGitRepositoryEventNotification object:repository];
102102

103+
__weak PBGitHistoryController *weakSelf = self;
104+
commitList.findPanelActionBlock = ^(id sender){
105+
PBGitHistoryController *controller = weakSelf;
106+
if (!controller) {
107+
return;
108+
}
109+
[controller.view.window makeFirstResponder:controller->searchField];
110+
};
111+
103112
[super awakeFromNib];
104113
}
105114

Classes/PBCommitList.h

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
@class PBWebHistoryController;
1414

15+
typedef void(^PBFindPanelActionBlock)(id sender);
16+
1517
@interface PBCommitList : NSTableView {
1618
IBOutlet WebView* webView;
1719
IBOutlet PBWebHistoryController *webController;
@@ -24,4 +26,5 @@
2426

2527
@property (readonly) NSPoint mouseDownPoint;
2628
@property (assign) BOOL useAdjustScroll;
29+
@property (copy) PBFindPanelActionBlock findPanelActionBlock;
2730
@end

Classes/PBCommitList.m

+9
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,13 @@ - (void)highlightSelectionInClipRect:(NSRect)tableViewClipRect
185185
[super highlightSelectionInClipRect:tableViewClipRect];
186186
}
187187

188+
189+
- (IBAction)performFindPanelAction:(id)sender
190+
{
191+
PBFindPanelActionBlock block = self.findPanelActionBlock;
192+
if (block) {
193+
block(sender);
194+
}
195+
}
196+
188197
@end

0 commit comments

Comments
 (0)