Skip to content
Snippets Groups Projects
Commit 76fe643f authored by George Nachman's avatar George Nachman
Browse files

Add the ability to move the selection start/end forward/back to next/previous mark

parent b557e680
No related branches found
No related tags found
No related merge requests found
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9059" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9059"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="iTermEditKeyActionWindowController">
Loading
Loading
@@ -39,6 +39,7 @@
<textField verticalHuggingPriority="750" id="K5J-cS-cKV">
<rect key="frame" x="17" y="119" width="127" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Keyboard Shortcut:" id="yKb-4m-EJs">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
Loading
Loading
@@ -48,6 +49,7 @@
<textField verticalHuggingPriority="750" id="SiS-Fz-x6B">
<rect key="frame" x="17" y="94" width="127" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="Action:" id="GiU-A2-oLi">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
Loading
Loading
@@ -57,6 +59,7 @@
<popUpButton verticalHuggingPriority="750" id="GMz-jA-Nhg">
<rect key="frame" x="146" y="88" width="279" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="push" title="Ignore" bezelStyle="rounded" alignment="left" lineBreakMode="clipping" borderStyle="borderAndBezel" tag="13" inset="2" pullsDown="YES" arrowPosition="arrowAtCenter" preferredEdge="maxY" id="NkH-n8-Fjv">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
Loading
Loading
@@ -174,10 +177,10 @@
<menuItem isSeparatorItem="YES" id="svX-cj-e8M"/>
<menuItem title="Run Coprocess" tag="35" id="m6l-mc-bhF"/>
<menuItem isSeparatorItem="YES" id="D8m-Tb-i1k"/>
<menuItem title="Move Start of Selection Left" tag="47" id="YBg-Ld-iyY"/>
<menuItem title="Move Start of Selection Right" tag="48" id="OUd-6i-YQe"/>
<menuItem title="Move End of Selection Left" tag="45" id="L33-q3-stz"/>
<menuItem title="Move End of Selection Right" tag="46" id="xRC-3K-RlB"/>
<menuItem title="Move Start of Selection Back" tag="47" id="YBg-Ld-iyY"/>
<menuItem title="Move Start of Selection Forward" tag="48" id="OUd-6i-YQe"/>
<menuItem title="Move End of Selection Back" tag="45" id="L33-q3-stz"/>
<menuItem title="Move End of Selection Forward" tag="46" id="xRC-3K-RlB"/>
<menuItem isSeparatorItem="YES" id="c8c-8I-caf"/>
<menuItem title="Select Menu Item..." tag="25" id="haJ-OE-peX"/>
</items>
Loading
Loading
@@ -191,6 +194,7 @@
<button verticalHuggingPriority="750" id="loN-RU-1Py">
<rect key="frame" x="350" y="12" width="78" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="push" title="OK" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="zMC-Yr-nMr">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Loading
Loading
@@ -205,6 +209,7 @@ DQ
<button verticalHuggingPriority="750" id="rEh-rY-u5S">
<rect key="frame" x="268" y="12" width="82" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
<animations/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="Fhv-Fo-bzd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Loading
Loading
@@ -220,6 +225,7 @@ Gw
<textField verticalHuggingPriority="750" id="q03-HA-vno" userLabel="Parameter Label">
<rect key="frame" x="106" y="48" width="318" height="33"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" title="Esc+" id="WbG-ev-YAV">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
Loading
Loading
@@ -229,6 +235,7 @@ Gw
<textField verticalHuggingPriority="750" id="OcE-sI-T64" userLabel="Shortcut Text Field" customClass="iTermShortcutInputView">
<rect key="frame" x="149" y="119" width="273" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="lcf-pM-rft">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
Loading
Loading
@@ -242,6 +249,7 @@ Gw
<textField verticalHuggingPriority="750" id="7JT-ar-Qef" userLabel="Parameter">
<rect key="frame" x="149" y="62" width="273" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="left" placeholderString="ex: 0x7f" drawsBackground="YES" id="QTL-FQ-Diu">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
Loading
Loading
@@ -251,6 +259,7 @@ Gw
<popUpButton hidden="YES" verticalHuggingPriority="750" id="a20-Tf-Nfn" userLabel="Profile popup">
<rect key="frame" x="146" y="58" width="279" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="XwG-yb-SyJ">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
Loading
Loading
@@ -263,7 +272,8 @@ Gw
<popUpButton hidden="YES" verticalHuggingPriority="750" id="otv-pU-Wmk" userLabel="Selection movement unit">
<rect key="frame" x="146" y="58" width="279" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Move by Line" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="2" imageScaling="proportionallyDown" inset="2" selectedItem="Ysw-TJ-E0w" id="4Hl-iX-9pJ">
<animations/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="4Hl-iX-9pJ">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<menu key="menu" title="OtherViews" id="Xfc-fg-vql">
Loading
Loading
@@ -274,7 +284,10 @@ Gw
<menuItem title="Move by Word" tag="1" id="Ujq-Yh-FZ2">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Move by Line" state="on" tag="2" id="Ysw-TJ-E0w" userLabel="Move by Line">
<menuItem title="Move by Line" tag="2" id="Ysw-TJ-E0w" userLabel="Move by Line">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Move by Mark" tag="3" id="cCu-Aq-YHj" userLabel="Move by Mark">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
</items>
Loading
Loading
@@ -287,6 +300,7 @@ Gw
<textField hidden="YES" verticalHuggingPriority="750" id="mKz-sR-Rez" userLabel="Profile Label">
<rect key="frame" x="96" y="64" width="48" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Profile:" id="T00-UT-45K">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
Loading
Loading
@@ -296,6 +310,7 @@ Gw
<textField hidden="YES" verticalHuggingPriority="750" id="TtY-N0-xlA" userLabel="Color Preset Label">
<rect key="frame" x="58" y="64" width="85" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Color Preset:" id="gdc-og-Wst">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
Loading
Loading
@@ -305,6 +320,7 @@ Gw
<popUpButton hidden="YES" verticalHuggingPriority="750" id="Lul-IP-GkH" userLabel="Menu items popup">
<rect key="frame" x="146" y="59" width="279" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" id="1oe-ia-azx">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
Loading
Loading
@@ -314,6 +330,7 @@ Gw
<popUpButton hidden="YES" verticalHuggingPriority="750" id="tld-gp-ZWP" userLabel="Color presets popup">
<rect key="frame" x="146" y="59" width="279" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" autoenablesItems="NO" id="Hw8-s8-mNF">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
Loading
Loading
@@ -323,10 +340,13 @@ Gw
<customView id="6C1-2g-xev">
<rect key="frame" x="20" y="-164" width="444" height="248"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<animations/>
</customView>
</subviews>
<animations/>
</view>
</subviews>
<animations/>
</view>
<connections>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
Loading
Loading
Loading
Loading
@@ -327,6 +327,14 @@
- (void)textViewCreateTabWithProfileGuid:(NSString *)guid {
}
 
- (int)lineNumberOfMarkAfterLine:(int)line {
return line + 1;
}
- (int)lineNumberOfMarkBeforeLine:(int)line {
return line - 1;
}
- (VT100ScreenMark *)markOnLine:(int)line {
return nil;
}
Loading
Loading
Loading
Loading
@@ -58,6 +58,7 @@ typedef NS_ENUM(NSInteger, PTYTextViewSelectionExtensionUnit) {
kPTYTextViewSelectionExtensionUnitCharacter,
kPTYTextViewSelectionExtensionUnitWord,
kPTYTextViewSelectionExtensionUnitLine,
kPTYTextViewSelectionExtensionUnitMark,
};
 
@protocol PTYTextViewDelegate <NSObject>
Loading
Loading
Loading
Loading
@@ -3714,6 +3714,7 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
case kPTYTextViewSelectionExtensionUnitCharacter:
case kPTYTextViewSelectionExtensionUnitWord:
case kPTYTextViewSelectionExtensionUnitLine:
case kPTYTextViewSelectionExtensionUnitMark:
unitRecognized = YES;
break;
}
Loading
Loading
@@ -3789,6 +3790,18 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
newRange = rangeWithLineBeforeStart;
break;
}
case kPTYTextViewSelectionExtensionUnitMark: {
VT100GridWindowedRange rangeWithLineBeforeStart = existingRange;
if (rangeWithLineBeforeStart.coordRange.start.y > 0) {
rangeWithLineBeforeStart.coordRange.start.y = [_dataSource lineNumberOfMarkBeforeLine:existingRange.coordRange.start.y] + 1;
if (rangeWithLineBeforeStart.coordRange.start.y == existingRange.coordRange.start.y) {
rangeWithLineBeforeStart.coordRange.start.y = [_dataSource lineNumberOfMarkBeforeLine:existingRange.coordRange.start.y - 1] + 1;
}
rangeWithLineBeforeStart.coordRange.start.x = existingRange.columnWindow.location;
}
newRange = rangeWithLineBeforeStart;
break;
}
}
break;
}
Loading
Loading
@@ -3828,6 +3841,15 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
newRange = rangeExcludingFirstLine;
break;
}
case kPTYTextViewSelectionExtensionUnitMark: {
VT100GridWindowedRange rangeExcludingFirstLine = existingRange;
rangeExcludingFirstLine.coordRange.start.x = existingRange.columnWindow.location;
rangeExcludingFirstLine.coordRange.start.y =
MIN(_dataSource.numberOfLines,
[_dataSource lineNumberOfMarkAfterLine:rangeExcludingFirstLine.coordRange.start.y] + 1);
newRange = rangeExcludingFirstLine;
break;
}
}
break;
}
Loading
Loading
@@ -3866,6 +3888,20 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
newRange = rangeExcludingLastLine;
break;
}
case kPTYTextViewSelectionExtensionUnitMark: {
VT100GridWindowedRange rangeExcludingLastLine = existingRange;
int rightMargin;
if (existingRange.columnWindow.length) {
rightMargin = VT100GridRangeMax(existingRange.columnWindow) + 1;
} else {
rightMargin = _dataSource.width;
}
rangeExcludingLastLine.coordRange.end.x = rightMargin;
int n = [_dataSource lineNumberOfMarkBeforeLine:rangeExcludingLastLine.coordRange.end.y + 1];
rangeExcludingLastLine.coordRange.end.y = MAX(1, n - 1);
newRange = rangeExcludingLastLine;
break;
}
}
break;
}
Loading
Loading
@@ -3913,6 +3949,26 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
newRange = rangeWithLineAfterEnd;
break;
}
case kPTYTextViewSelectionExtensionUnitMark: {
VT100GridWindowedRange rangeWithLineAfterEnd = existingRange;
int rightMargin;
if (existingRange.columnWindow.length) {
rightMargin = VT100GridRangeMax(existingRange.columnWindow) + 1;
} else {
rightMargin = _dataSource.width;
}
rangeWithLineAfterEnd.coordRange.end.x = rightMargin;
rangeWithLineAfterEnd.coordRange.end.y =
MIN(_dataSource.numberOfLines,
[_dataSource lineNumberOfMarkAfterLine:rangeWithLineAfterEnd.coordRange.end.y] - 1);
if (rangeWithLineAfterEnd.coordRange.end.y == existingRange.coordRange.end.y) {
rangeWithLineAfterEnd.coordRange.end.y =
MIN(_dataSource.numberOfLines,
[_dataSource lineNumberOfMarkAfterLine:rangeWithLineAfterEnd.coordRange.end.y + 1] - 1);
}
newRange = rangeWithLineAfterEnd;
break;
}
}
break;
}
Loading
Loading
@@ -3933,6 +3989,9 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
case kPTYTextViewSelectionExtensionUnitLine:
mode = kiTermSelectionModeLine;
break;
case kPTYTextViewSelectionExtensionUnitMark:
mode = kiTermSelectionModeLine;
break;
}
 
if ([_selection coord:newRange.coordRange.start isBeforeCoord:newRange.coordRange.end]) {
Loading
Loading
Loading
Loading
@@ -97,6 +97,9 @@
- (VT100GridCoordRange)coordRangeOfNote:(PTYNoteViewController *)note;
- (NSArray *)charactersWithNotesOnLine:(int)line;
- (VT100ScreenMark *)markOnLine:(int)line;
- (int)lineNumberOfMarkAfterLine:(int)line;
- (int)lineNumberOfMarkBeforeLine:(int)line;
- (NSString *)workingDirectoryOnLine:(int)line;
- (SCPPath *)scpPathForFile:(NSString *)filename onLine:(int)line;
- (VT100RemoteHost *)remoteHostOnLine:(int)line;
Loading
Loading
Loading
Loading
@@ -2051,6 +2051,38 @@ static NSString *const kInlineFileBase64String = @"base64 string"; // NSMutable
return objects;
}
 
- (int)lineNumberOfMarkBeforeLine:(int)line {
Interval *interval = [self intervalForGridCoordRange:VT100GridCoordRangeMake(0, line, 0, line)];
NSEnumerator *enumerator = [intervalTree_ reverseLimitEnumeratorAt:interval.limit];
NSArray *objects = [enumerator nextObject];
while (objects) {
for (id object in objects) {
if ([object isKindOfClass:[VT100ScreenMark class]]) {
VT100ScreenMark *mark = object;
return [self coordRangeForInterval:mark.entry.interval].start.y;
}
}
objects = [enumerator nextObject];
}
return line;
}
- (int)lineNumberOfMarkAfterLine:(int)line {
Interval *interval = [self intervalForGridCoordRange:VT100GridCoordRangeMake(0, line + 1, 0, line + 1)];
NSEnumerator *enumerator = [intervalTree_ forwardLimitEnumeratorAt:interval.limit];
NSArray *objects = [enumerator nextObject];
while (objects) {
for (id object in objects) {
if ([object isKindOfClass:[VT100ScreenMark class]]) {
VT100ScreenMark *mark = object;
return [self coordRangeForInterval:mark.entry.interval].end.y;
}
}
objects = [enumerator nextObject];
}
return line;
}
- (NSArray *)marksOrNotesBefore:(Interval *)location {
NSEnumerator *enumerator = [intervalTree_ reverseLimitEnumeratorAt:location.limit];
NSArray *objects;
Loading
Loading
Loading
Loading
@@ -72,6 +72,8 @@
*/
 
#import "ITAddressBookMgr.h"
#import "DebugLogging.h"
#import "iTermKeyBindingMgr.h"
#import "iTermPasteSpecialViewController.h"
#import "iTermPreferences.h"
Loading
Loading
@@ -492,10 +494,11 @@ static NSString *const kFactoryDefaultsGlobalPreset = @"Factory Defaults";
return @"By Character";
case kPTYTextViewSelectionExtensionUnitWord:
return @"By Word";
default:
NSLog(@"Unrecognized selection movement unit %@", @(unit));
return @"";
case kPTYTextViewSelectionExtensionUnitMark:
return @"By Mark";
}
ELog(@"Unrecognized selection movement unit %@", @(unit));
return @"";
}
 
+ (BOOL)haveGlobalKeyMappingForKeyString:(NSString*)keyString
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment