Skip to content

Commit 611e5c8

Browse files
committed
Merge pull request johnno1962#18 from zenangst/master
Add wrap around setting
2 parents a51c0e9 + 52ee780 commit 611e5c8

3 files changed

Lines changed: 62 additions & 11 deletions

File tree

Classes/GitDiff.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ typedef NS_ENUM(NSInteger, GitDiffGutterType) {
1313
GitDiffGutterTypeVerbose
1414
};
1515

16+
typedef NS_ENUM(NSInteger, GitDiffWrapNavigation) {
17+
GitDiffWrapNavigationDefault = 0,
18+
GitDiffWrapNavigationEnabled
19+
};
20+
1621
@interface GitDiff : NSObject
1722

1823
@end

Classes/GitDiff.mm

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ - (instancetype)init
9898
[userDefaults setInteger:GitDiffGutterTypeDefault forKey:@"GitDiffGutterMode"];
9999
}
100100

101+
if (![userDefaults objectForKey:@"GitDiffWrapNavigation"]) {
102+
[userDefaults setInteger:GitDiffWrapNavigationDefault forKey:@"GitDiffWrapNavigation"];
103+
}
104+
101105
return self;
102106
}
103107

@@ -564,7 +568,7 @@ - (void)nextChangeAction:(id)sender
564568
if ([diffArray count] == 0) return;
565569

566570
NSNumber *currentLineNumber = @([[self currentEditor] _currentOneBasedLineNubmer]);
567-
BOOL wrapAround = NO;
571+
BOOL wrapAround = [[NSUserDefaults standardUserDefaults] boolForKey:@"GitDiffWrapNavigation"];
568572

569573
for (NSNumber *line in diffArray) {
570574
if ([currentLineNumber compare:line] == NSOrderedAscending) {
@@ -593,7 +597,7 @@ - (void)previousChangeAction:(id)sender
593597
if ([diffArray count] == 0) return;
594598

595599
NSNumber *currentLineNumber = @([[self currentEditor] _currentOneBasedLineNubmer]);
596-
BOOL wrapAround = NO;
600+
BOOL wrapAround = [[NSUserDefaults standardUserDefaults] boolForKey:@"GitDiffWrapNavigation"];
597601

598602
for (NSNumber *line in [diffArray reverseObjectEnumerator]) {
599603
if ([currentLineNumber compare:line] == NSOrderedDescending) {

Classes/GitDiff.xib

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6245" systemVersion="14A361c" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6245" systemVersion="14A379a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
33
<dependencies>
44
<deployment defaultVersion="1070" identifier="macosx"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6245"/>
@@ -20,14 +20,14 @@
2020
<window title="GitDiff Configuration" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="QvC-M9-y7g">
2121
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
2222
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
23-
<rect key="contentRect" x="196" y="240" width="308" height="202"/>
23+
<rect key="contentRect" x="196" y="240" width="308" height="279"/>
2424
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="878"/>
2525
<view key="contentView" id="EiT-Mj-1SZ">
26-
<rect key="frame" x="0.0" y="5" width="308" height="202"/>
26+
<rect key="frame" x="0.0" y="5" width="308" height="279"/>
2727
<autoresizingMask key="autoresizingMask"/>
2828
<subviews>
2929
<box autoresizesSubviews="NO" title="Colors" borderType="line" id="Ivu-Kd-Qvr">
30-
<rect key="frame" x="17" y="50" width="274" height="132"/>
30+
<rect key="frame" x="17" y="127" width="274" height="132"/>
3131
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
3232
<view key="contentView">
3333
<rect key="frame" x="1" y="1" width="272" height="116"/>
@@ -137,17 +137,17 @@ Gw
137137
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
138138
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
139139
</box>
140-
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="aVx-1I-iMp">
141-
<rect key="frame" x="34" y="24" width="91" height="17"/>
140+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="BPa-Fd-Sui">
141+
<rect key="frame" x="46" y="41" width="74" height="17"/>
142142
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
143-
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Gutter marks:" id="FKM-2f-yPZ">
143+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Navigation:" id="7OE-Ja-0wQ">
144144
<font key="font" metaFont="system"/>
145145
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
146146
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
147147
</textFieldCell>
148148
</textField>
149149
<popUpButton verticalHuggingPriority="750" id="nV0-ew-buy">
150-
<rect key="frame" x="129" y="17" width="145" height="26"/>
150+
<rect key="frame" x="129" y="88" width="145" height="26"/>
151151
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
152152
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" id="6ZP-Tm-stV">
153153
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
@@ -163,9 +163,51 @@ Gw
163163
<binding destination="Y8c-8q-f8n" name="selectedIndex" keyPath="values.GitDiffGutterMode" id="ka5-nQ-F3G"/>
164164
</connections>
165165
</popUpButton>
166+
<box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="Dhu-2Z-gBk">
167+
<rect key="frame" x="20" y="73" width="268" height="5"/>
168+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
169+
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
170+
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
171+
<font key="titleFont" metaFont="system"/>
172+
</box>
173+
<matrix verticalHuggingPriority="750" allowsEmptySelection="NO" autorecalculatesCellSize="YES" id="Okf-tP-Nw5">
174+
<rect key="frame" x="131" y="20" width="140" height="38"/>
175+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
176+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
177+
<size key="cellSize" width="121" height="18"/>
178+
<size key="intercellSpacing" width="4" height="2"/>
179+
<buttonCell key="prototype" type="radio" title="Radio" imagePosition="left" alignment="left" inset="2" id="ATZ-N2-spP">
180+
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
181+
<font key="font" metaFont="system"/>
182+
</buttonCell>
183+
<cells>
184+
<column>
185+
<buttonCell type="radio" title="No wrap around" imagePosition="left" alignment="left" state="on" tag="1" inset="2" id="9Nv-UU-ktQ">
186+
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
187+
<font key="font" metaFont="system"/>
188+
</buttonCell>
189+
<buttonCell type="radio" title="Wrap around" imagePosition="left" alignment="left" inset="2" id="oZ0-eJ-ba7">
190+
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
191+
<font key="font" metaFont="system"/>
192+
</buttonCell>
193+
</column>
194+
</cells>
195+
<connections>
196+
<binding destination="Y8c-8q-f8n" name="selectedIndex" keyPath="values.GitDiffWrapNavigation" id="r56-0I-CY3"/>
197+
</connections>
198+
</matrix>
199+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="aVx-1I-iMp">
200+
<rect key="frame" x="34" y="93" width="91" height="17"/>
201+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
202+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Gutter marks:" id="FKM-2f-yPZ">
203+
<font key="font" metaFont="system"/>
204+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
205+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
206+
</textFieldCell>
207+
</textField>
166208
</subviews>
167209
</view>
168-
<point key="canvasLocation" x="279" y="323"/>
210+
<point key="canvasLocation" x="279" y="361.5"/>
169211
</window>
170212
<userDefaultsController representsSharedInstance="YES" id="Y8c-8q-f8n"/>
171213
</objects>

0 commit comments

Comments
 (0)