Skip to content

Commit

Permalink
Add support for saved search keyboard shortcuts and, correspondingly,…
Browse files Browse the repository at this point in the history
… temporary searches in the FindViewController.
  • Loading branch information
gnachman committed Apr 5, 2014
1 parent 67d463e commit e12620a
Show file tree
Hide file tree
Showing 9 changed files with 228 additions and 187 deletions.
18 changes: 11 additions & 7 deletions English.lproj/PreferencePanel.xib
Original file line number Diff line number Diff line change
Expand Up @@ -3829,7 +3829,7 @@ Gw
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="3866">
<rect key="frame" x="360" y="417" width="144" height="17"/>
<rect key="frame" x="361" y="416" width="151" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Global Shortcut Keys" id="3867">
<font key="font" metaFont="systemBold"/>
Expand Down Expand Up @@ -4081,11 +4081,11 @@ Gw
<rect key="frame" x="363" y="30" width="508" height="379"/>
<autoresizingMask key="autoresizingMask"/>
<clipView key="contentView" id="Dzn-LP-RyA">
<rect key="frame" x="1" y="17" width="490" height="361"/>
<rect key="frame" x="1" y="17" width="506" height="361"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" autosaveName="KeyBingingTable" headerView="3855" id="3852">
<rect key="frame" x="0.0" y="0.0" width="490" height="361"/>
<rect key="frame" x="0.0" y="0.0" width="506" height="361"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
Expand All @@ -4105,7 +4105,7 @@ Gw
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
</tableColumn>
<tableColumn identifier="1" editable="NO" width="286.101" minWidth="42.10107" maxWidth="1000" id="3856">
<tableColumn identifier="1" editable="NO" width="302.101" minWidth="42.10107" maxWidth="1000" id="3856">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Action">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -4136,7 +4136,7 @@ Gw
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" id="3855">
<rect key="frame" x="0.0" y="0.0" width="490" height="17"/>
<rect key="frame" x="0.0" y="0.0" width="506" height="17"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
<connections>
Expand Down Expand Up @@ -4824,12 +4824,12 @@ Gw
<popUpButton verticalHuggingPriority="750" id="2661">
<rect key="frame" x="146" y="88" width="243" height="26"/>
<autoresizingMask key="autoresizingMask"/>
<popUpButtonCell key="cell" type="push" title="Ignore" bezelStyle="rounded" alignment="left" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" tag="13" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="5152" id="2682">
<popUpButtonCell key="cell" type="push" title="Find Regular Expression…" bezelStyle="rounded" alignment="left" lineBreakMode="clipping" state="on" borderStyle="borderAndBezel" tag="36" inset="2" arrowPosition="arrowAtCenter" preferredEdge="maxY" selectedItem="HLy-fr-uJd" id="2682">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="2683">
<items>
<menuItem title="Ignore" state="on" tag="13" id="5152"/>
<menuItem title="Ignore" tag="13" id="5152"/>
<menuItem isSeparatorItem="YES" id="4723"/>
<menuItem title="Do Not Remap Modifiers" tag="22" id="4427"/>
<menuItem title="Remap Modifiers in iTerm2 Only" tag="24" id="4722"/>
Expand Down Expand Up @@ -4897,6 +4897,10 @@ Gw
<menuItem title="Send Hex Code" tag="11" id="2691"/>
<menuItem title="Send Text" tag="12" id="2697"/>
<menuItem isSeparatorItem="YES" id="4428"/>
<menuItem title="Find Regular Expression…" state="on" tag="36" id="HLy-fr-uJd">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="YBB-ZY-fWM"/>
<menuItem title="Toggle Fullscreen" tag="23" id="4429"/>
<menuItem isSeparatorItem="YES" id="4749"/>
<menuItem title="Run Coprocess" tag="35" id="6330"/>
Expand Down
33 changes: 9 additions & 24 deletions FindViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
- (void)clearHighlights;

// Preform a search
- (BOOL)findString:(NSString *)aString
- (void)findString:(NSString *)aString
forwardDirection:(BOOL)direction
ignoringCase:(BOOL)ignoreCase
regex:(BOOL)regex
Expand All @@ -77,29 +77,7 @@
@end


@interface FindViewController : NSViewController <NSTextFieldDelegate> {
IBOutlet NSSearchField* findBarTextField_;
IBOutlet NSProgressIndicator* findBarProgressIndicator_;
// These pointers are just "prototypes" and do not refer to any actual menu
// items.
IBOutlet NSMenuItem* ignoreCaseMenuItem_;
IBOutlet NSMenuItem* regexMenuItem_;
BOOL ignoreCase_;
BOOL regex_;

// Find happens incrementally. This remembers the string to search for.
NSMutableString* previousFindString_;

// Find runs out of a timer so that if you have a huge buffer then it
// doesn't lock up. This timer runs the show.
NSTimer* timer_;

id<FindViewControllerDelegate> delegate_;
NSRect fullFrame_;
NSSize textFieldSize_;
NSSize textFieldSmallSize_;
}

@interface FindViewController : NSViewController <NSTextFieldDelegate>
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil;
- (void)dealloc;
- (void)close;
Expand All @@ -118,4 +96,11 @@
- (void)setDelegate:(id<FindViewControllerDelegate>)delegate;
- (id<FindViewControllerDelegate>)delegate;

// Performs a "temporary" search. The current state (case sensitivity, regex)
// is saved and the find view is hidden. A search is performed and the user can
// navigate with with next-previous. When the find window is opened, the state
// is restored.
- (void)closeViewAndDoTemporarySearchForString:(NSString *)string
ignoringCase:(BOOL)ignoringCase
regex:(BOOL)regex;
@end
Loading

0 comments on commit e12620a

Please sign in to comment.