Skip to content

Commit

Permalink
Improve search UI
Browse files Browse the repository at this point in the history
Previously searching would filter the commits in the commit tableview to only show the commits that matched the search. However the context of where those commits exist in the history is lost.

With this patch all the commits are shown but the commits that match the search are highlighted with a light blue background. In addition there is a forward/back button to step through the matches.

A new search controller:
    - keeps track of the matching results
    - finds the next or previous result
    - displays the number of matches found or "Not found"
    - shows/hides the # of matches text and the next/last stepper button
    - shows a small bezel style window with a rewind icon indicating that the selection has cycled (pressing next when at the last match or previous when at the first)
    - sets up the search predicate which covers Subject, Author and SHA (previously this was three different searches)
    - stores search results in an NSIndexSet to make finding if a row is in the set faster (needed at drawing time)

Highlighting of search result rows is done in PBCommitList -drawRow:clipRect:

PBGitTextFieldCell is a subclass of NSTextFieldCell that disables the cell's selection highlighting.

Supporting Find Next and Find Previous (cmd-g and cmd-shift-g) menu commands required changing the action method of the menu items because NSTextFields (seem to) actively disable items in the Find menu.

rewindImage.pdf created by Nathan Kinsinger
  • Loading branch information
brotherbard committed Sep 13, 2010
1 parent 80596ad commit 4fad6b6
Show file tree
Hide file tree
Showing 13 changed files with 1,057 additions and 148 deletions.
170 changes: 149 additions & 21 deletions English.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">804</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">804</string>
<string key="NS.object.0">788</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="169"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -1104,22 +1103,6 @@
</object>
<int key="connectionID">199</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">performFindPanelAction:</string>
<reference key="source" ref="954860085"/>
<reference key="destination" ref="416521231"/>
</object>
<int key="connectionID">200</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">performFindPanelAction:</string>
<reference key="source" ref="954860085"/>
<reference key="destination" ref="219112383"/>
</object>
<int key="connectionID">201</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">performFindPanelAction:</string>
Expand Down Expand Up @@ -1368,6 +1351,22 @@
</object>
<int key="connectionID">966</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">selectNext:</string>
<reference key="source" ref="954860085"/>
<reference key="destination" ref="416521231"/>
</object>
<int key="connectionID">967</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">selectPrevious:</string>
<reference key="source" ref="954860085"/>
<reference key="destination" ref="219112383"/>
</object>
<int key="connectionID">968</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
Expand Down Expand Up @@ -2332,7 +2331,7 @@
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>{{864, 473}, {238, 103}}</string>
<string>{{762, 747}, {238, 103}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
Expand Down Expand Up @@ -2498,7 +2497,7 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">966</int>
<int key="maxID">968</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down Expand Up @@ -2665,6 +2664,13 @@
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">NSApplication+GitXScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSOutlineView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
Expand All @@ -2688,12 +2694,14 @@
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>controller</string>
<string>searchController</string>
<string>webController</string>
<string>webView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>PBGitHistoryController</string>
<string>PBHistorySearchController</string>
<string>PBWebHistoryController</string>
<string>WebView</string>
</object>
Expand All @@ -2703,6 +2711,7 @@
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>controller</string>
<string>searchController</string>
<string>webController</string>
<string>webView</string>
</object>
Expand All @@ -2712,6 +2721,10 @@
<string key="name">controller</string>
<string key="candidateClassName">PBGitHistoryController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">searchController</string>
<string key="candidateClassName">PBHistorySearchController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">webController</string>
<string key="candidateClassName">PBWebHistoryController</string>
Expand Down Expand Up @@ -3148,6 +3161,7 @@
<string>rebaseButton</string>
<string>refController</string>
<string>scopeBarView</string>
<string>searchController</string>
<string>searchField</string>
<string>selectedBranchFilterItem</string>
<string>treeController</string>
Expand All @@ -3168,6 +3182,7 @@
<string>NSButton</string>
<string>PBRefController</string>
<string>PBGitGradientBarView</string>
<string>PBHistorySearchController</string>
<string>NSSearchField</string>
<string>NSButton</string>
<string>NSTreeController</string>
Expand All @@ -3191,6 +3206,7 @@
<string>rebaseButton</string>
<string>refController</string>
<string>scopeBarView</string>
<string>searchController</string>
<string>searchField</string>
<string>selectedBranchFilterItem</string>
<string>treeController</string>
Expand Down Expand Up @@ -3244,6 +3260,10 @@
<string key="name">scopeBarView</string>
<string key="candidateClassName">PBGitGradientBarView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">searchController</string>
<string key="candidateClassName">PBHistorySearchController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">searchField</string>
<string key="candidateClassName">NSSearchField</string>
Expand Down Expand Up @@ -3617,6 +3637,78 @@
<string key="minorKey"/>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">PBHistorySearchController</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">stepperPressed:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">stepperPressed:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">stepperPressed:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>commitController</string>
<string>historyController</string>
<string>numberOfMatchesField</string>
<string>searchField</string>
<string>stepper</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSArrayController</string>
<string>PBGitHistoryController</string>
<string>NSTextField</string>
<string>NSSearchField</string>
<string>NSSegmentedControl</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>commitController</string>
<string>historyController</string>
<string>numberOfMatchesField</string>
<string>searchField</string>
<string>stepper</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">commitController</string>
<string key="candidateClassName">NSArrayController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">historyController</string>
<string key="candidateClassName">PBGitHistoryController</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">numberOfMatchesField</string>
<string key="candidateClassName">NSTextField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">searchField</string>
<string key="candidateClassName">NSSearchField</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">stepper</string>
<string key="candidateClassName">NSSegmentedControl</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">PBHistorySearchController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">PBNiceSplitView</string>
<string key="superclassName">NSSplitView</string>
Expand Down Expand Up @@ -4542,6 +4634,34 @@
<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ScriptingBridge.framework/Headers/SBApplication.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
Expand Down Expand Up @@ -4678,6 +4798,14 @@
<string key="minorKey">AppKit.framework/Headers/NSSearchField.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSegmentedControl</string>
<string key="superclassName">NSControl</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSSegmentedControl.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSSplitView</string>
<string key="superclassName">NSView</string>
Expand Down
Loading

0 comments on commit 4fad6b6

Please sign in to comment.