diff --git a/GLFileView.m b/GLFileView.m
index 7087130..512bfa3 100644
--- a/GLFileView.m
+++ b/GLFileView.m
@@ -639,14 +639,7 @@
-(IBAction)updateSearch:(NSSearchField *)sender
{
- NSString *searchString = [sender stringValue];
- DLog(@"searchString:%@",searchString);
-
- if([searchString length]>0){
- [view highlightAllOccurencesOfString:searchString];
- }else{
- [view removeAllHighlights];
- }
+ [view updateSearch:sender];
}
#pragma mark -
diff --git a/PBGitHistoryView.xib b/PBGitHistoryView.xib
index 30ae89a..5f632e9 100644
--- a/PBGitHistoryView.xib
+++ b/PBGitHistoryView.xib
@@ -138,6 +138,7 @@
292
{{267, 3}, {71, 25}}
+
YES
- {{0, 211}, {749, 24}}
+ {{0, 206}, {749, 24}}
+
MGScopeBar
@@ -1344,8 +1382,9 @@
public.url-name
- {749, 210}
+ {749, 205}
+
@@ -1354,21 +1393,24 @@
YES
- {{208, 0}, {749, 235}}
+ {{208, 0}, {749, 230}}
+
NSView
- {{-1, -1}, {957, 235}}
+ {{-1, -1}, {957, 230}}
+
YES
2
- {955, 233}
+ {955, 228}
+
Tree
@@ -1387,20 +1429,23 @@
- {{0, 172}, {955, 233}}
+ {{0, 177}, {955, 228}}
+
NSView
{955, 405}
+
- 2
+ 3
{955, 434}
+
NSView
@@ -2907,7 +2952,6 @@
18.IBPluginDependency
19.CustomClassName
19.IBPluginDependency
- 2.CustomClassName
2.IBEditorWindowLastContentRect
2.IBPluginDependency
2.ImportedFromIB2
@@ -3030,7 +3074,6 @@
com.apple.InterfaceBuilder.CocoaPlugin
PBIconAndTextCell
com.apple.InterfaceBuilder.CocoaPlugin
- PBCollapsibleSplitView
{{312, 577}, {852, 384}}
com.apple.InterfaceBuilder.CocoaPlugin
@@ -3230,7 +3273,845 @@
508
-
+
+
+ YES
+
+ GLFileView
+ PBWebController
+
+ updateSearch:
+ NSSearchField
+
+
+ updateSearch:
+
+ updateSearch:
+ NSSearchField
+
+
+
+ YES
+
+ YES
+ accessoryView
+ fileListSplitView
+ historyController
+ searchField
+ typeBar
+
+
+ YES
+ NSView
+ NSSplitView
+ PBGitHistoryController
+ NSSearchField
+ MGScopeBar
+
+
+
+ YES
+
+ YES
+ accessoryView
+ fileListSplitView
+ historyController
+ searchField
+ typeBar
+
+
+ YES
+
+ accessoryView
+ NSView
+
+
+ fileListSplitView
+ NSSplitView
+
+
+ historyController
+ PBGitHistoryController
+
+
+ searchField
+ NSSearchField
+
+
+ typeBar
+ MGScopeBar
+
+
+
+
+ IBProjectSource
+ ./Classes/GLFileView.h
+
+
+
+ GitXRelativeDateFormatter
+ NSFormatter
+
+ IBProjectSource
+ ./Classes/GitXRelativeDateFormatter.h
+
+
+
+ GitXTextFieldCell
+ NSTextFieldCell
+
+ contextMenuDelegate
+ id
+
+
+ contextMenuDelegate
+
+ contextMenuDelegate
+ id
+
+
+
+ IBProjectSource
+ ./Classes/GitXTextFieldCell.h
+
+
+
+ MGScopeBar
+ NSView
+
+ delegate
+ id
+
+
+ delegate
+
+ delegate
+ id
+
+
+
+ IBProjectSource
+ ./Classes/MGScopeBar.h
+
+
+
+ PBCollapsibleSplitView
+ NSSplitView
+
+ IBProjectSource
+ ./Classes/PBCollapsibleSplitView.h
+
+
+
+ PBCommitList
+ NSTableView
+
+ YES
+
+ YES
+ controller
+ searchController
+ webController
+ webView
+
+
+ YES
+ PBGitHistoryController
+ PBHistorySearchController
+ PBWebHistoryController
+ WebView
+
+
+
+ YES
+
+ YES
+ controller
+ searchController
+ webController
+ webView
+
+
+ YES
+
+ controller
+ PBGitHistoryController
+
+
+ searchController
+ PBHistorySearchController
+
+
+ webController
+ PBWebHistoryController
+
+
+ webView
+ WebView
+
+
+
+
+ IBProjectSource
+ ./Classes/PBCommitList.h
+
+
+
+ PBGitGradientBarView
+ NSView
+
+ IBProjectSource
+ ./Classes/PBGitGradientBarView.h
+
+
+
+ PBGitHistoryController
+ PBViewController
+
+ YES
+
+ YES
+ cherryPick:
+ createBranch:
+ createTag:
+ merge:
+ openSelectedFile:
+ rebase:
+ refresh:
+ selectNext:
+ selectPrevious:
+ setBranchFilter:
+ setDetailedView:
+ setTreeView:
+ showAddRemoteSheet:
+ toggleQLPreviewPanel:
+ updateSearch:
+
+
+ YES
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+ id
+
+
+
+ YES
+
+ YES
+ cherryPick:
+ createBranch:
+ createTag:
+ merge:
+ openSelectedFile:
+ rebase:
+ refresh:
+ selectNext:
+ selectPrevious:
+ setBranchFilter:
+ setDetailedView:
+ setTreeView:
+ showAddRemoteSheet:
+ toggleQLPreviewPanel:
+ updateSearch:
+
+
+ YES
+
+ cherryPick:
+ id
+
+
+ createBranch:
+ id
+
+
+ createTag:
+ id
+
+
+ merge:
+ id
+
+
+ openSelectedFile:
+ id
+
+
+ rebase:
+ id
+
+
+ refresh:
+ id
+
+
+ selectNext:
+ id
+
+
+ selectPrevious:
+ id
+
+
+ setBranchFilter:
+ id
+
+
+ setDetailedView:
+ id
+
+
+ setTreeView:
+ id
+
+
+ showAddRemoteSheet:
+ id
+
+
+ toggleQLPreviewPanel:
+ id
+
+
+ updateSearch:
+ id
+
+
+
+
+ YES
+
+ YES
+ allBranchesFilterItem
+ cherryPickButton
+ commitController
+ commitList
+ fileBrowser
+ fileView
+ filesSearchField
+ historySplitView
+ localRemoteBranchesFilterItem
+ mergeButton
+ rebaseButton
+ refController
+ scopeBarView
+ searchController
+ searchField
+ selectedBranchFilterItem
+ treeController
+ upperToolbarView
+ webHistoryController
+ webView
+
+
+ YES
+ NSButton
+ NSButton
+ NSArrayController
+ PBCommitList
+ NSOutlineView
+ GLFileView
+ NSSearchField
+ PBCollapsibleSplitView
+ NSButton
+ NSButton
+ NSButton
+ PBRefController
+ PBGitGradientBarView
+ PBHistorySearchController
+ NSSearchField
+ NSButton
+ NSTreeController
+ PBGitGradientBarView
+ PBWebHistoryController
+ id
+
+
+
+ YES
+
+ YES
+ allBranchesFilterItem
+ cherryPickButton
+ commitController
+ commitList
+ fileBrowser
+ fileView
+ filesSearchField
+ historySplitView
+ localRemoteBranchesFilterItem
+ mergeButton
+ rebaseButton
+ refController
+ scopeBarView
+ searchController
+ searchField
+ selectedBranchFilterItem
+ treeController
+ upperToolbarView
+ webHistoryController
+ webView
+
+
+ YES
+
+ allBranchesFilterItem
+ NSButton
+
+
+ cherryPickButton
+ NSButton
+
+
+ commitController
+ NSArrayController
+
+
+ commitList
+ PBCommitList
+
+
+ fileBrowser
+ NSOutlineView
+
+
+ fileView
+ GLFileView
+
+
+ filesSearchField
+ NSSearchField
+
+
+ historySplitView
+ PBCollapsibleSplitView
+
+
+ localRemoteBranchesFilterItem
+ NSButton
+
+
+ mergeButton
+ NSButton
+
+
+ rebaseButton
+ NSButton
+
+
+ refController
+ PBRefController
+
+
+ scopeBarView
+ PBGitGradientBarView
+
+
+ searchController
+ PBHistorySearchController
+
+
+ searchField
+ NSSearchField
+
+
+ selectedBranchFilterItem
+ NSButton
+
+
+ treeController
+ NSTreeController
+
+
+ upperToolbarView
+ PBGitGradientBarView
+
+
+ webHistoryController
+ PBWebHistoryController
+
+
+ webView
+ id
+
+
+
+
+ IBProjectSource
+ ./Classes/PBGitHistoryController.h
+
+
+
+ PBGitRevisionCell
+ NSActionCell
+
+ YES
+
+ YES
+ contextMenuDelegate
+ controller
+
+
+ YES
+ id
+ PBGitHistoryController
+
+
+
+ YES
+
+ YES
+ contextMenuDelegate
+ controller
+
+
+ YES
+
+ contextMenuDelegate
+ id
+
+
+ controller
+ PBGitHistoryController
+
+
+
+
+ IBProjectSource
+ ./Classes/PBGitRevisionCell.h
+
+
+
+ PBHistorySearchController
+ NSObject
+
+ YES
+
+ YES
+ stepperPressed:
+ updateSearch:
+
+
+ YES
+ id
+ id
+
+
+
+ YES
+
+ YES
+ stepperPressed:
+ updateSearch:
+
+
+ YES
+
+ stepperPressed:
+ id
+
+
+ updateSearch:
+ id
+
+
+
+
+ YES
+
+ YES
+ commitController
+ historyController
+ numberOfMatchesField
+ progressIndicator
+ searchField
+ stepper
+
+
+ YES
+ NSArrayController
+ PBGitHistoryController
+ NSTextField
+ NSProgressIndicator
+ NSSearchField
+ NSSegmentedControl
+
+
+
+ YES
+
+ YES
+ commitController
+ historyController
+ numberOfMatchesField
+ progressIndicator
+ searchField
+ stepper
+
+
+ YES
+
+ commitController
+ NSArrayController
+
+
+ historyController
+ PBGitHistoryController
+
+
+ numberOfMatchesField
+ NSTextField
+
+
+ progressIndicator
+ NSProgressIndicator
+
+
+ searchField
+ NSSearchField
+
+
+ stepper
+ NSSegmentedControl
+
+
+
+
+ IBProjectSource
+ ./Classes/PBHistorySearchController.h
+
+
+
+ PBIconAndTextCell
+ NSTextFieldCell
+
+ IBProjectSource
+ ./Classes/PBIconAndTextCell.h
+
+
+
+ PBQLOutlineView
+ NSOutlineView
+
+ controller
+ PBGitHistoryController
+
+
+ controller
+
+ controller
+ PBGitHistoryController
+
+
+
+ IBProjectSource
+ ./Classes/PBQLOutlineView.h
+
+
+
+ PBRefController
+ NSObject
+
+ YES
+
+ YES
+ branchPopUp
+ commitController
+ commitList
+ historyController
+
+
+ YES
+ NSPopUpButton
+ NSArrayController
+ PBCommitList
+ PBGitHistoryController
+
+
+
+ YES
+
+ YES
+ branchPopUp
+ commitController
+ commitList
+ historyController
+
+
+ YES
+
+ branchPopUp
+ NSPopUpButton
+
+
+ commitController
+ NSArrayController
+
+
+ commitList
+ PBCommitList
+
+
+ historyController
+ PBGitHistoryController
+
+
+
+
+ IBProjectSource
+ ./Classes/PBRefController.h
+
+
+
+ PBUnsortableTableHeader
+ NSTableHeaderView
+
+ controller
+ NSArrayController
+
+
+ controller
+
+ controller
+ NSArrayController
+
+
+
+ IBProjectSource
+ ./Classes/PBUnsortableTableHeader.h
+
+
+
+ PBViewController
+ NSViewController
+
+ refresh:
+ id
+
+
+ refresh:
+
+ refresh:
+ id
+
+
+
+ IBProjectSource
+ ./Classes/PBViewController.h
+
+
+
+ PBWebController
+ NSObject
+
+ YES
+
+ YES
+ repository
+ view
+
+
+ YES
+ id
+ WebView
+
+
+
+ YES
+
+ YES
+ repository
+ view
+
+
+ YES
+
+ repository
+ id
+
+
+ view
+ WebView
+
+
+
+
+ IBProjectSource
+ ./Classes/PBWebController.h
+
+
+
+ PBWebHistoryController
+ PBWebController
+
+ YES
+
+ YES
+ contextMenuDelegate
+ historyController
+
+
+ YES
+ id
+ PBGitHistoryController
+
+
+
+ YES
+
+ YES
+ contextMenuDelegate
+ historyController
+
+
+ YES
+
+ contextMenuDelegate
+ id
+
+
+ historyController
+ PBGitHistoryController
+
+
+
+
+ IBProjectSource
+ ./Classes/PBWebHistoryController.h
+
+
+
+ WebView
+
+ reloadFromOrigin:
+ id
+
+
+ reloadFromOrigin:
+
+ reloadFromOrigin:
+ id
+
+
+
+ IBProjectSource
+ ./Classes/WebView.h
+
+
+
+
0
IBCocoaFramework
diff --git a/SearchWebView.h b/SearchWebView.h
index 1f90e46..6438df3 100644
--- a/SearchWebView.h
+++ b/SearchWebView.h
@@ -11,8 +11,9 @@
@interface WebView (SearchWebView)
-- (NSInteger)highlightAllOccurencesOfString:(NSString*)str;
+- (DOMRange *)highlightAllOccurencesOfString:(NSString*)str;
- (NSInteger)highlightAllOccurencesOfString:(NSString*)str inNode:(DOMNode *)node;
- (void)removeAllHighlights;
+- (void)updateSearch:(NSSearchField *)sender;
@end
diff --git a/SearchWebView.m b/SearchWebView.m
index 5a21e40..7daa148 100644
--- a/SearchWebView.m
+++ b/SearchWebView.m
@@ -50,19 +50,43 @@
return count;
}
-- (NSInteger)highlightAllOccurencesOfString:(NSString*)str
+- (DOMRange *)highlightAllOccurencesOfString:(NSString*)str
{
NSInteger count=0;
+ DOMRange *res=nil;
if([[[[self mainFrame] DOMDocument] documentElement] isKindOfClass:[DOMHTMLElement class]]){
DOMHTMLElement *dom=(DOMHTMLElement *)[[[self mainFrame] DOMDocument] documentElement];
if(![str isEqualToString:[dom getAttribute:@"searchStr"]]){
[self removeAllHighlights];
count=[self highlightAllOccurencesOfString:str inNode:dom];
+ if(count>0){
+ [dom setAttribute:@"searchStr" value:str];
+ }
+ }
+ if([self searchFor:str direction:YES caseSensitive:NO wrap:YES]){
+ res=[self selectedDOMRange];
}
}
- return count;
+ return res;
+}
+
+- (void)updateSearch:(NSSearchField *)sender
+{
+ NSString *searchString = [sender stringValue];
+ DLog(@"searchString:%@",searchString);
+
+ DOMRange *selection;
+
+ if([searchString length]>0){
+ selection=[self highlightAllOccurencesOfString:searchString];
+ [[sender window] makeFirstResponder:sender];
+ if(selection!=nil)
+ [self setSelectedDOMRange:selection affinity:NSSelectionAffinityDownstream];
+ }else{
+ [self removeAllHighlights];
+ }
}
- (void)removeAllHighlights:(DOMNode *)_node