Permalink
Browse files

Add smart case sensitivity to find on page as the default option. Aut…

…omatically upgrade users from case-insensitive substring search to smart case sensitivity. General style cleanup of find view controller code. Issue 4690
  • Loading branch information...
1 parent be3c0a4 commit e88f5f43c9d64908fe1f9800fd52fe193709f923 @gnachman committed Jan 2, 2017
@@ -1,15 +1,15 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6250"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="FindViewController">
<connections>
<outlet property="findBarTextField_" destination="2" id="27"/>
- <outlet property="ignoreCaseMenuItem_" destination="16" id="33"/>
- <outlet property="regexMenuItem_" destination="17" id="34"/>
+ <outlet property="smartCaseMenuItem_" destination="6Px-6a-JTm" id="Q8P-T3-Pom"/>
<outlet property="view" destination="1" id="10"/>
</connections>
</customObject>
@@ -64,16 +64,36 @@ Gw
</customView>
<menu id="15">
<items>
- <menuItem title="Ignore case" state="on" id="16">
+ <menuItem title="Smart Case Substring" state="on" id="16">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
- <action selector="toggleIgnoreCase:" target="-2" id="31"/>
+ <action selector="changeMode:" target="-2" id="OVp-ei-63a"/>
</connections>
</menuItem>
- <menuItem title="Regular expression" state="on" id="17">
+ <menuItem isSeparatorItem="YES" id="qHP-Qy-WFh"/>
+ <menuItem title="Case-Sensitive Substring" state="on" tag="1" id="IJN-DB-LJ2">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
- <action selector="toggleRegex:" target="-2" id="32"/>
+ <action selector="changeMode:" target="-2" id="tWH-sW-7Ij"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Case-Insensitive Substring" state="on" tag="2" id="6Px-6a-JTm">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="changeMode:" target="-2" id="aPy-bk-w39"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="F1b-pc-PFJ"/>
+ <menuItem title="Case-Sensitive Regex" state="on" tag="3" id="s1o-x7-jkk">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="changeMode:" target="-2" id="cem-eD-Fft"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Case-Insensitive Regex" state="on" tag="4" id="C2V-dA-zRG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="changeMode:" target="-2" id="ZJX-A7-7La"/>
</connections>
</menuItem>
</items>
@@ -407,7 +407,7 @@ - (BOOL)textViewSuppressingAllOutput {
- (void)textViewRestartWithConfirmation {
}
-- (void)setFindString:(NSString *)aString forwardDirection:(BOOL)direction ignoringCase:(BOOL)ignoreCase regex:(BOOL)regex startingAtX:(int)x startingAtY:(int)y withOffset:(int)offsetof inContext:(FindContext *)context multipleResults:(BOOL)multipleResults {
+- (void)setFindString:(NSString *)aString forwardDirection:(BOOL)direction mode:(iTermFindMode)mode startingAtX:(int)x startingAtY:(int)y withOffset:(int)offsetof inContext:(FindContext *)context multipleResults:(BOOL)multipleResults {
}
- (PTYTask *)shell {
@@ -2236,8 +2236,7 @@ - (void)testFindMatches {
[textView resetFindCursor];
[textView findString:@"xx"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
withOffset:0];
double progress;
while ([textView findInProgress]) {
@@ -864,6 +864,24 @@ - (NSInteger)screenUnicodeVersion {
- (void)screenSetUnicodeVersion:(NSInteger)unicodeVersion {
}
+- (void)screenDidFinishReceivingInlineFile {
+}
+
+- (void)screenSelectColorPresetNamed:(NSString *)name {
+}
+
+- (void)screenSetLabel:(NSString *)label forKey:(NSString *)keyName {
+}
+
+- (void)screenPushKeyLabels:(NSString *)value {
+}
+
+- (void)screenPopKeyLabels:(NSString *)value {
+}
+
+- (void)screenTerminalAttemptedPasteboardAccess {
+}
+
#pragma mark - iTermSelectionDelegate
- (void)selectionDidChange:(iTermSelection *)selection {
@@ -2192,8 +2210,7 @@ - (void)testAPIsUsedByTailFind {
ctx.maxTime = 0;
[screen setFindString:@"wxyz"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:0
withOffset:0
@@ -2221,8 +2238,7 @@ - (void)testAPIsUsedByTailFind {
[self appendLines:@[@"0123", @"wxyz"] toScreen:screen];
[screen setFindString:@"wxyz"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:7 // Past bottom of screen
withOffset:0
@@ -2251,8 +2267,7 @@ - (void)testAPIsUsedByTailFind {
FindContext *myFindContext = [[[FindContext alloc] init] autorelease];
[screen setFindString:@"mnop"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:[screen numberOfLines] + 1 + [screen totalScrollbackOverflow]
withOffset:0
@@ -2275,8 +2290,7 @@ - (void)testAPIsUsedByTailFind {
FindContext *tailFindContext = [[[FindContext alloc] init] autorelease];
[screen setFindString:@"rst"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:0
withOffset:0
@@ -2297,8 +2311,7 @@ - (void)testAPIsUsedByTailFind {
tailFindContext = [[[FindContext alloc] init] autorelease];
[screen setFindString:@"rst"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:0
withOffset:0
@@ -2410,8 +2423,7 @@ - (void)testAbsoluteLineNumberOfCursor {
- (void)assertSearchInScreen:(VT100Screen *)screen
forPattern:(NSString *)pattern
forwardDirection:(BOOL)forward
- ignoringCase:(BOOL)ignoreCase
- regex:(BOOL)regex
+ mode:(iTermFindMode)mode
startingAtX:(int)startX
startingAtY:(int)startY
withOffset:(int)offset
@@ -2422,8 +2434,7 @@ - (void)assertSearchInScreen:(VT100Screen *)screen
[[screen findContext] setMaxTime:0];
[screen setFindString:pattern
forwardDirection:forward
- ignoringCase:ignoreCase
- regex:regex
+ mode:mode
startingAtX:startX
startingAtY:startY
withOffset:offset
@@ -2444,8 +2455,7 @@ - (void)assertSearchInScreen:(VT100Screen *)screen
- (void)assertSearchInScreenLines:(NSString *)compactLines
forPattern:(NSString *)pattern
forwardDirection:(BOOL)forward
- ignoringCase:(BOOL)ignoreCase
- regex:(BOOL)regex
+ mode:(iTermFindMode)mode
startingAtX:(int)startX
startingAtY:(int)startY
withOffset:(int)offset
@@ -2454,8 +2464,7 @@ - (void)assertSearchInScreenLines:(NSString *)compactLines
[self assertSearchInScreen:screen
forPattern:pattern
forwardDirection:forward
- ignoringCase:ignoreCase
- regex:regex
+ mode:mode
startingAtX:startX
startingAtY:startY
withOffset:offset
@@ -2475,8 +2484,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"cde"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:0
withOffset:0
@@ -2486,8 +2494,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"cde"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:2
startingAtY:4
withOffset:0
@@ -2497,8 +2504,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"cde"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:2
startingAtY:4
withOffset:0
@@ -2508,8 +2514,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"cde"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:3
startingAtY:4
withOffset:0
@@ -2518,8 +2523,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"cde"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:3
startingAtY:2
withOffset:0
@@ -2528,8 +2532,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"cde"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:1
startingAtY:0
withOffset:0
@@ -2539,8 +2542,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"CDE"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:0
withOffset:0
@@ -2549,8 +2551,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"CDE"
forwardDirection:YES
- ignoringCase:YES
- regex:NO
+ mode:iTermFindModeCaseInsensitiveSubstring
startingAtX:0
startingAtY:0
withOffset:0
@@ -2560,8 +2561,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"c.e"
forwardDirection:YES
- ignoringCase:NO
- regex:YES
+ mode:iTermFindModeCaseSensitiveRegex
startingAtX:0
startingAtY:0
withOffset:0
@@ -2570,8 +2570,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"C.E"
forwardDirection:YES
- ignoringCase:YES
- regex:YES
+ mode:iTermFindModeCaseInsensitiveRegex
startingAtX:0
startingAtY:0
withOffset:0
@@ -2581,8 +2580,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"de"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:3
startingAtY:0
withOffset:0
@@ -2592,8 +2590,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"de"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:3
startingAtY:0
withOffset:1
@@ -2603,8 +2600,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"de"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:2
withOffset:0
@@ -2614,8 +2610,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"de"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:2
withOffset:1
@@ -2625,8 +2620,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"Yz"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:0
withOffset:0
@@ -2636,8 +2630,7 @@ - (void)testFind {
[self assertSearchInScreenLines:lines
forPattern:@"xYz"
forwardDirection:YES
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:0
withOffset:0
@@ -2673,8 +2666,7 @@ - (void)testFind {
[self assertSearchInScreen:screen
forPattern:@"def"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:12
withOffset:0
@@ -2698,8 +2690,7 @@ - (void)testFind {
[self assertSearchInScreen:screen
forPattern:@"spam"
forwardDirection:NO
- ignoringCase:NO
- regex:NO
+ mode:iTermFindModeCaseSensitiveSubstring
startingAtX:0
startingAtY:12
withOffset:0
@@ -1,5 +1,6 @@
#include <wctype.h>
#import "Autocomplete.h"
+#import "FindViewController.h"
#import "iTermAdvancedSettingsModel.h"
#import "iTermApplicationDelegate.h"
#import "iTermCommandHistoryEntryMO+Additions.h"
@@ -342,8 +343,7 @@ - (void)refresh {
more_ = YES;
[screen setFindString:prefix_
forwardDirection:NO
- ignoringCase:YES
- regex:NO
+ mode:iTermFindModeCaseInsensitiveSubstring
startingAtX:x_
startingAtY:y_
withOffset:1
Oops, something went wrong.

0 comments on commit e88f5f4

Please sign in to comment.