Permalink
Browse files

Improve search UI

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...
1 parent 80596ad commit 4fad6b60a383463530f3854783e80f7a789a7263 @brotherbard committed Aug 29, 2010
@@ -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>
@@ -1108,22 +1107,6 @@
<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>
- <reference key="source" ref="954860085"/>
<reference key="destination" ref="899097995"/>
</object>
<int key="connectionID">202</int>
@@ -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">
@@ -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>
@@ -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">
@@ -2666,6 +2665,13 @@
</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">
<string key="majorKey">IBProjectSource</string>
@@ -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>
@@ -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>
@@ -2713,6 +2722,10 @@
<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>
</object>
@@ -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>
@@ -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>
@@ -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>
@@ -3245,6 +3261,10 @@
<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>
</object>
@@ -3618,6 +3638,78 @@
</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>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@@ -4546,6 +4638,34 @@
<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">
+ <string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Sparkle.framework/Headers/SUAppcast.h</string>
</object>
</object>
@@ -4679,6 +4799,14 @@
</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>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
Oops, something went wrong. Retry.

0 comments on commit 4fad6b6

Please sign in to comment.