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

Merge branch 'master' of https://github.com/gnachman/iTerm2

parents 101698bf d40c14de
No related branches found
No related tags found
No related merge requests found
Showing
with 712 additions and 238 deletions
before_install: ./ci/before_install.sh
bundler_args: --without documentation --without development --deployment --jobs=3 --retry=3
osx_image: xcode8.3
osx_image: xcode9.0
language: objective-c
script: ./ci/script.sh
after_success: ./ci/after_success.sh
Loading
Loading
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="16E195" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13196" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13196"/>
<capability name="box content view" minToolsVersion="7.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Loading
Loading
@@ -2379,7 +2380,7 @@ DQ
</connections>
</button>
<button misplaced="YES" id="5148">
<rect key="frame" x="280" y="309" width="154" height="18"/>
<rect key="frame" x="324" y="309" width="154" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Blinking text allowed" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="5149">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Loading
Loading
@@ -2409,7 +2410,7 @@ DQ
</textFieldCell>
</textField>
<button misplaced="YES" id="4773">
<rect key="frame" x="287" y="366" width="119" height="18"/>
<rect key="frame" x="324" y="366" width="119" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Blinking cursor" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="4834">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Loading
Loading
@@ -2597,19 +2598,6 @@ DQ
<action selector="settingChanged:" target="lhd-u6-xr5" id="aVZ-El-bBQ"/>
</connections>
</popUpButton>
<button misplaced="YES" id="jlZ-SF-XtE">
<rect key="frame" x="280" y="234" width="207" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<string key="toolTip">Apps (such as your shell or your editor) expect each character to have a particular “width,” between 0 and 2 cells. If the app and the terminal emulator have different width tables, rendering problems ensue. Notably, Unicode 8 defines most Emoji to be 1 cell wide. Most fonts render them as two cells wide. Unicode 9 fixes this. If your apps have been updated for Unicode 9, you should enable this.</string>
<buttonCell key="cell" type="check" title="Use Unicode Version 9 Widths" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="usB-uD-pmw">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="settingChanged:" target="lhd-u6-xr5" id="c3k-nj-VMp"/>
<outlet property="nextKeyView" destination="4765" id="uIt-qC-lLY"/>
</connections>
</button>
<button misplaced="YES" id="mlk-a6-xcL">
<rect key="frame" x="18" y="123" width="106" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
Loading
Loading
@@ -2623,7 +2611,7 @@ DQ
<outlet property="nextKeyView" destination="4774" id="1Qu-x3-jY5"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" allowsCharacterPickerTouchBarItem="NO" id="MOD-dL-6SH">
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" misplaced="YES" id="MOD-dL-6SH">
<rect key="frame" x="18" y="235" width="176" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Unicode normalization form:" id="lS7-WI-sn5">
Loading
Loading
@@ -2633,7 +2621,7 @@ DQ
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" misplaced="YES" id="XDS-1Z-hVv">
<rect key="frame" x="198" y="229" width="71" height="26"/>
<rect key="frame" x="198" y="229" width="84" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="None" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="td0-LJ-Zf9" id="ttZ-UD-tsk">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
Loading
Loading
@@ -2673,7 +2661,7 @@ DQ
</textFieldCell>
</textField>
<button misplaced="YES" id="6400">
<rect key="frame" x="280" y="289" width="134" height="18"/>
<rect key="frame" x="324" y="289" width="134" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Italic text allowed" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="6401">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
Loading
Loading
@@ -2696,6 +2684,19 @@ DQ
<outlet property="nextKeyView" destination="4765" id="5254"/>
</connections>
</button>
<button misplaced="YES" id="jlZ-SF-XtE">
<rect key="frame" x="324" y="234" width="207" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<string key="toolTip">Apps (such as your shell or your editor) expect each character to have a particular “width,” between 0 and 2 cells. If the app and the terminal emulator have different width tables, rendering problems ensue. Notably, Unicode 8 defines most Emoji to be 1 cell wide. Most fonts render them as two cells wide. Unicode 9 fixes this. If your apps have been updated for Unicode 9, you should enable this.</string>
<buttonCell key="cell" type="check" title="Use Unicode Version 9 Widths" bezelStyle="regularSquare" imagePosition="left" alignment="left" inset="2" id="usB-uD-pmw">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="settingChanged:" target="lhd-u6-xr5" id="c3k-nj-VMp"/>
<outlet property="nextKeyView" destination="4765" id="uIt-qC-lLY"/>
</connections>
</button>
</subviews>
<point key="canvasLocation" x="-37.5" y="658.5"/>
</customView>
Loading
Loading
@@ -3448,7 +3449,7 @@ DQ
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" id="ArV-0K-qze">
<rect key="frame" x="1" y="1" width="511" height="95"/>
<autoresizingMask key="autoresizingMask"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" id="5661">
<rect key="frame" x="0.0" y="0.0" width="511" height="95"/>
Loading
Loading
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Loading
Loading
@@ -32,7 +32,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" id="yan-v0-dhd">
<rect key="frame" x="1" y="0.0" width="463" height="260"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="firstColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="7EL-It-qNK" id="JC7-GD-2vC">
<rect key="frame" x="0.0" y="0.0" width="463" height="243"/>
Loading
Loading
@@ -89,7 +89,7 @@
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
<searchField wantsLayer="YES" verticalHuggingPriority="750" id="PwG-br-FdK" customClass="iTermSearchField">
<searchField wantsLayer="YES" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="PwG-br-FdK" customClass="iTermSearchField">
<rect key="frame" x="20" y="318" width="465" height="22"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" placeholderString="Account Name" usesSingleLineMode="YES" bezelStyle="round" id="lOy-Zp-5fu">
Loading
Loading
@@ -176,6 +176,12 @@ Gw
<action selector="revealPassword:" target="-2" id="afJ-HM-r97"/>
</connections>
</menuItem>
<menuItem title="Copy Password" id="JCZ-Y8-Qwb">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="copyPassword:" target="-2" id="MWE-rW-rkX"/>
</connections>
</menuItem>
</items>
<point key="canvasLocation" x="-482" y="379"/>
</menu>
Loading
Loading
Loading
Loading
@@ -17,14 +17,14 @@
- (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag
{
self = [super initWithFrame:frameRect pullsDown:YES];
if (self) {
if (self) {
[self setBezelStyle:NSRegularSquareBezelStyle];
[self setBordered:NO];
[self setTitle:@""];
[self setPreferredEdge:NSMaxXEdge];
_PSMTabBarOverflowPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"overflowImage"]];
_PSMTabBarOverflowDownPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"overflowImagePressed"]];
_animatingAlternateImage = NO;
_PSMTabBarOverflowDownPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForImageResource:@"overflowImagePressed"]];
_animatingAlternateImage = NO;
}
return self;
}
Loading
Loading
@@ -32,7 +32,7 @@
- (void)dealloc
{
[_PSMTabBarOverflowPopUpImage release];
[_PSMTabBarOverflowDownPopUpImage release];
[_PSMTabBarOverflowDownPopUpImage release];
[super dealloc];
}
 
Loading
Loading
@@ -42,89 +42,91 @@
[super drawRect:rect];
return;
}
NSImage *image = (_down) ? _PSMTabBarOverflowDownPopUpImage : _PSMTabBarOverflowPopUpImage;
NSSize imageSize = [image size];
NSRect bounds = [self bounds];
NSPoint drawPoint = NSMakePoint(NSMidX(bounds) - (imageSize.width * 0.5f), NSMidY(bounds) - (imageSize.height * 0.5f));
NSSize imageSize = [image size];
NSRect bounds = [self bounds];
NSPoint drawPoint = NSMakePoint(NSMidX(bounds) - (imageSize.width * 0.5f), NSMidY(bounds) - (imageSize.height * 0.5f));
 
[image drawAtPoint:drawPoint
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:_animatingAlternateImage ? 0.7f : 1.0f];
 
if (_animatingAlternateImage) {
NSImage *alternateImage = [self alternateImage];
NSSize altImageSize = [alternateImage size];
drawPoint = NSMakePoint(NSMidX(bounds) - (altImageSize.width * 0.5f),
if (_animatingAlternateImage) {
NSImage *alternateImage = [self alternateImage];
NSSize altImageSize = [alternateImage size];
drawPoint = NSMakePoint(NSMidX(bounds) - (altImageSize.width * 0.5f),
NSMidY(bounds) - (altImageSize.height * 0.5f));
 
[[self alternateImage] drawAtPoint:drawPoint
fromRect:NSZeroRect
operation:NSCompositeSourceOver
fraction:sin(_animationValue * M_PI)];
}
}
}
 
- (void)mouseDown:(NSEvent *)event
{
_down = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationReceived:) name:NSMenuDidEndTrackingNotification object:[self menu]];
[self setNeedsDisplay:YES];
[super mouseDown:event];
_down = YES;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationReceived:) name:NSMenuDidEndTrackingNotification object:[self menu]];
[self setNeedsDisplay:YES];
[super mouseDown:event];
}
 
- (void)setHidden:(BOOL)value
{
if (!value && _animatingAlternateImage) {
_animationValue = ANIMATION_STEP;
_animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
} else {
[_animationTimer invalidate], _animationTimer = nil;
}
[super setHidden:value];
if (!value && _animatingAlternateImage) {
_animationValue = ANIMATION_STEP;
_animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
} else {
[_animationTimer invalidate];
_animationTimer = nil;
}
[super setHidden:value];
}
 
- (void)notificationReceived:(NSNotification *)notification
{
_down = NO;
[self setNeedsDisplay:YES];
[[NSNotificationCenter defaultCenter] removeObserver:self];
_down = NO;
[self setNeedsDisplay:YES];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
 
- (void)setAnimatingAlternateImage:(BOOL)flag
{
_animatingAlternateImage = flag;
[self setNeedsDisplay:YES];
if (![self isHidden] && !_animationTimer) {
if (flag) {
_animationValue = ANIMATION_STEP;
_animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
} else {
[_animationTimer invalidate], _animationTimer = nil;
}
}
_animatingAlternateImage = flag;
[self setNeedsDisplay:YES];
if (![self isHidden] && !_animationTimer) {
if (flag) {
_animationValue = ANIMATION_STEP;
_animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
} else {
[_animationTimer invalidate];
_animationTimer = nil;
}
}
}
 
- (BOOL)animatingAlternateImage
{
return _animatingAlternateImage;
return _animatingAlternateImage;
}
 
- (void)animateStep:(NSTimer *)timer
{
_animationValue += ANIMATION_STEP;
if (_animationValue >= 1) {
_animationValue = ANIMATION_STEP;
}
[self setNeedsDisplay:YES];
_animationValue += ANIMATION_STEP;
if (_animationValue >= 1) {
_animationValue = ANIMATION_STEP;
}
[self setNeedsDisplay:YES];
}
 
#pragma mark -
Loading
Loading
@@ -135,7 +137,7 @@
if ([aCoder allowsKeyedCoding]) {
[aCoder encodeObject:_PSMTabBarOverflowPopUpImage forKey:@"PSMTabBarOverflowPopUpImage"];
[aCoder encodeObject:_PSMTabBarOverflowDownPopUpImage forKey:@"PSMTabBarOverflowDownPopUpImage"];
[aCoder encodeBool:_animatingAlternateImage forKey:@"PSMTabBarOverflowAnimatingAlternateImage"];
[aCoder encodeBool:_animatingAlternateImage forKey:@"PSMTabBarOverflowAnimatingAlternateImage"];
}
}
 
Loading
Loading
@@ -144,7 +146,7 @@
if ([aDecoder allowsKeyedCoding]) {
_PSMTabBarOverflowPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"] retain];
_PSMTabBarOverflowDownPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"] retain];
[self setAnimatingAlternateImage:[aDecoder decodeBoolForKey:@"PSMTabBarOverflowAnimatingAlternateImage"]];
[self setAnimatingAlternateImage:[aDecoder decodeBoolForKey:@"PSMTabBarOverflowAnimatingAlternateImage"]];
}
}
return self;
Loading
Loading
Loading
Loading
@@ -67,6 +67,8 @@ const NSInteger kPSMStartResizeAnimation = 0;
// drag and drop
NSEvent *_lastMouseDownEvent; // keep this for dragging reference
NSEvent *_lastMiddleMouseDownEvent;
BOOL _haveInitialDragLocation;
NSPoint _initialDragLocation;
BOOL _didDrag;
BOOL _closeClicked;
 
Loading
Loading
@@ -1272,6 +1274,11 @@ const NSInteger kPSMStartResizeAnimation = 0;
if ([self lastMouseDownEvent] == nil) {
return;
}
if (!_haveInitialDragLocation) {
_initialDragLocation = [theEvent locationInWindow];
_haveInitialDragLocation = YES;
return;
}
 
NSPoint currentPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
 
Loading
Loading
@@ -1298,7 +1305,7 @@ const NSInteger kPSMStartResizeAnimation = 0;
}
 
NSRect cellFrame;
NSPoint trackingStartPoint = [self convertPoint:[[self lastMouseDownEvent] locationInWindow] fromView:nil];
NSPoint trackingStartPoint = [self convertPoint:_initialDragLocation fromView:nil];
PSMTabBarCell *cell = [self cellForPoint:trackingStartPoint cellFrame:&cellFrame];
if (cell) {
//check to see if the close button was the target in the clicked cell
Loading
Loading
@@ -1344,6 +1351,7 @@ const NSInteger kPSMStartResizeAnimation = 0;
 
- (void)mouseUp:(NSEvent *)theEvent
{
_haveInitialDragLocation = NO;
if (_resizing) {
_resizing = NO;
[[NSCursor arrowCursor] set];
Loading
Loading
@@ -1515,6 +1523,7 @@ const NSInteger kPSMStartResizeAnimation = 0;
}
 
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
_haveInitialDragLocation = NO;
if ([[[sender draggingPasteboard] types] indexOfObject:@"com.iterm2.psm.controlitem"] != NSNotFound ||
[self _delegateAcceptsSender:sender]) {
[[PSMTabDragAssistant sharedDragAssistant] performDragOperation:sender];
Loading
Loading
@@ -1526,6 +1535,7 @@ const NSInteger kPSMStartResizeAnimation = 0;
}
 
- (void)draggingSession:(NSDraggingSession *)session endedAtPoint:(NSPoint)aPoint operation:(NSDragOperation)operation {
_haveInitialDragLocation = NO;
if (operation != NSDragOperationNone) {
[self removeTabForCell:[[PSMTabDragAssistant sharedDragAssistant] draggedCell]];
[[PSMTabDragAssistant sharedDragAssistant] finishDrag];
Loading
Loading
Loading
Loading
@@ -492,7 +492,7 @@
 
[[[self sourceTabBar] tabView] removeTabViewItem:[[self draggedCell] representedObject]];
 
void (^fixOriginBlock)() = nil;
void (^fixOriginBlock)(void) = nil;
switch (self.sourceTabBar.tabLocation) {
case PSMTab_BottomTab: {
NSPoint bottomLeft = control.window.frame.origin;
Loading
Loading
Loading
Loading
@@ -106,7 +106,8 @@
 
- (void)dealloc
{
[_eventDate release], _eventDate = nil;
[_eventDate release];
_eventDate = nil;
[super dealloc];
}
Loading
Loading
Loading
Loading
@@ -42,16 +42,16 @@ static const NSUInteger SCEventsDefaultIgnoreEventsFromSubDirs = 1;
@interface SCEvents ()
 
static FSEventStreamRef _create_events_stream(SCEvents *watcher,
CFArrayRef paths,
CFTimeInterval latency,
FSEventStreamEventId sinceWhen);
CFArrayRef paths,
CFTimeInterval latency,
FSEventStreamEventId sinceWhen);
 
static void _events_callback(ConstFSEventStreamRef streamRef,
void *clientCallBackInfo,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[]);
void *clientCallBackInfo,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[]);
 
static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
 
Loading
Loading
@@ -80,10 +80,10 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
{
if ((self = [super init])) {
_isWatchingPaths = NO;
pthread_mutex_init(&_eventsLock, NULL);
pthread_mutex_init(&_eventsLock, NULL);
[self setResumeFromEventId:kFSEventStreamEventIdSinceNow];
[self setResumeFromEventId:kFSEventStreamEventIdSinceNow];
[self setNotificationLatency:SCEventsDefaultNotificationLatency];
[self setIgnoreEventsFromSubDirs:SCEventsDefaultIgnoreEventsFromSubDirs];
}
Loading
Loading
@@ -102,18 +102,18 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
*/
- (BOOL)flushEventStreamSync
{
pthread_mutex_lock(&_eventsLock);
pthread_mutex_lock(&_eventsLock);
if (!_isWatchingPaths) {
pthread_mutex_unlock(&_eventsLock);
return NO;
}
pthread_mutex_unlock(&_eventsLock);
return NO;
}
FSEventStreamFlushSync(_eventStream);
pthread_mutex_unlock(&_eventsLock);
pthread_mutex_unlock(&_eventsLock);
return YES;
}
 
Loading
Loading
@@ -126,17 +126,17 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
- (BOOL)flushEventStreamAsync
{
pthread_mutex_lock(&_eventsLock);
if (!_isWatchingPaths) {
pthread_mutex_unlock(&_eventsLock);
return NO;
}
pthread_mutex_unlock(&_eventsLock);
return NO;
}
FSEventStreamFlushAsync(_eventStream);
pthread_mutex_unlock(&_eventsLock);
pthread_mutex_unlock(&_eventsLock);
return YES;
}
 
Loading
Loading
@@ -165,19 +165,19 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
*/
- (BOOL)startWatchingPaths:(NSArray *)paths onRunLoop:(NSRunLoop *)runLoop
{
pthread_mutex_lock(&_eventsLock);
_runLoop = [runLoop getCFRunLoop];
pthread_mutex_lock(&_eventsLock);
_runLoop = [runLoop getCFRunLoop];
if ([paths count] == 0 || _isWatchingPaths) {
pthread_mutex_unlock(&_eventsLock);
return NO;
}
pthread_mutex_unlock(&_eventsLock);
return NO;
}
[self setWatchedPaths:paths];
_eventStream = _create_events_stream(self, ((CFArrayRef)_watchedPaths), _notificationLatency, _resumeFromEventId);
_eventStream = _create_events_stream(self, ((CFArrayRef)_watchedPaths), _notificationLatency, _resumeFromEventId);
// Schedule the event stream on the supplied run loop
FSEventStreamScheduleWithRunLoop(_eventStream, _runLoop, kCFRunLoopDefaultMode);
Loading
Loading
@@ -187,8 +187,8 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
_isWatchingPaths = YES;
pthread_mutex_unlock(&_eventsLock);
pthread_mutex_unlock(&_eventsLock);
return YES;
}
 
Loading
Loading
@@ -201,26 +201,28 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
*/
- (BOOL)stopWatchingPaths
{
pthread_mutex_lock(&_eventsLock);
pthread_mutex_lock(&_eventsLock);
if (!_isWatchingPaths) {
pthread_mutex_unlock(&_eventsLock);
return NO;
}
pthread_mutex_unlock(&_eventsLock);
return NO;
}
FSEventStreamStop(_eventStream);
if (_runLoop) FSEventStreamUnscheduleFromRunLoop(_eventStream, _runLoop, kCFRunLoopDefaultMode);
if (_runLoop) FSEventStreamUnscheduleFromRunLoop(_eventStream, _runLoop, kCFRunLoopDefaultMode);
FSEventStreamInvalidate(_eventStream);
if (_eventStream) FSEventStreamRelease(_eventStream), _eventStream = NULL;
if (_eventStream) {
FSEventStreamRelease(_eventStream);
_eventStream = NULL;
}
_isWatchingPaths = NO;
pthread_mutex_unlock(&_eventsLock);
pthread_mutex_unlock(&_eventsLock);
return YES;
}
 
Loading
Loading
@@ -231,13 +233,13 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
*/
- (NSString *)streamDescription
{
pthread_mutex_lock(&_eventsLock);
NSString *description = (_isWatchingPaths) ? (NSString *)FSEventStreamCopyDescription(_eventStream) : nil;
pthread_mutex_unlock(&_eventsLock);
return [description autorelease];
pthread_mutex_lock(&_eventsLock);
NSString *description = (_isWatchingPaths) ? (NSString *)FSEventStreamCopyDescription(_eventStream) : nil;
pthread_mutex_unlock(&_eventsLock);
return [description autorelease];
}
 
#pragma mark -
Loading
Loading
@@ -258,16 +260,19 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
 
- (void)dealloc
{
_delegate = nil;
// Stop the event stream if it's still running
if (_isWatchingPaths) [self stopWatchingPaths];
_delegate = nil;
// Stop the event stream if it's still running
if (_isWatchingPaths) [self stopWatchingPaths];
pthread_mutex_destroy(&_eventsLock);
pthread_mutex_destroy(&_eventsLock);
[_lastEvent release], _lastEvent = nil;
[_watchedPaths release], _watchedPaths = nil;
[_excludedPaths release], _excludedPaths = nil;
[_lastEvent release];
_lastEvent = nil;
[_watchedPaths release];
_watchedPaths = nil;
[_excludedPaths release];
_excludedPaths = nil;
[super dealloc];
}
Loading
Loading
@@ -284,21 +289,21 @@ static CFStringRef _strip_trailing_slash_from_path(CFStringRef path);
*/
static FSEventStreamRef _create_events_stream(SCEvents *watcher, CFArrayRef paths, CFTimeInterval latency, FSEventStreamEventId sinceWhen)
{
FSEventStreamContext callbackInfo;
callbackInfo.version = 0;
callbackInfo.info = (void *)watcher;
callbackInfo.retain = NULL;
callbackInfo.release = NULL;
callbackInfo.copyDescription = NULL;
FSEventStreamContext callbackInfo;
callbackInfo.version = 0;
callbackInfo.info = (void *)watcher;
callbackInfo.retain = NULL;
callbackInfo.release = NULL;
callbackInfo.copyDescription = NULL;
return FSEventStreamCreate(kCFAllocatorDefault,
&_events_callback,
&callbackInfo,
paths,
sinceWhen,
latency,
kFSEventStreamCreateFlagUseCFTypes | kFSEventStreamCreateFlagWatchRoot);
&_events_callback,
&callbackInfo,
paths,
sinceWhen,
latency,
kFSEventStreamCreateFlagUseCFTypes | kFSEventStreamCreateFlagWatchRoot);
}
 
/**
Loading
Loading
@@ -316,20 +321,20 @@ static FSEventStreamRef _create_events_stream(SCEvents *watcher, CFArrayRef path
* @param eventIds An array of IDs associated with the events
*/
static void _events_callback(ConstFSEventStreamRef streamRef,
void *clientCallBackInfo,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[])
void *clientCallBackInfo,
size_t numEvents,
void *eventPaths,
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[])
{
NSUInteger i;
BOOL shouldIgnore = NO;
CFArrayRef paths = (CFArrayRef)eventPaths;
CFArrayRef paths = (CFArrayRef)eventPaths;
SCEvents *pathWatcher = (SCEvents *)clientCallBackInfo;
for (i = 0; i < numEvents; i++)
{
{
/* Please note that we are estimating the date for when the event occurred
* because the FSEvents API does not provide us with it. This date however
* should not be taken as the date the event actually occurred and more
Loading
Loading
@@ -345,8 +350,8 @@ static void _events_callback(ConstFSEventStreamRef streamRef,
* The drawback to this approach however, is the increased resources required
* calling this callback more frequently.
*/
NSArray *excludedPaths = [pathWatcher excludedPaths];
NSArray *excludedPaths = [pathWatcher excludedPaths];
CFStringRef eventPath = CFArrayGetValueAtIndex(paths, (CFIndex)i);
// Check to see if the event should be ignored if it's path is in the exclude list
Loading
Loading
@@ -358,25 +363,25 @@ static void _events_callback(ConstFSEventStreamRef streamRef,
// sub-directories then see if the exclude paths match as a prefix of the event path.
if ([pathWatcher ignoreEventsFromSubDirs]) {
for (NSString *path in [pathWatcher excludedPaths])
{
if (CFStringHasPrefix(eventPath, (CFStringRef)path)) {
shouldIgnore = YES;
{
if (CFStringHasPrefix(eventPath, (CFStringRef)path)) {
shouldIgnore = YES;
break;
}
}
}
}
}
if (!shouldIgnore) {
// If present remove the path's trailing slash
eventPath = _strip_trailing_slash_from_path(eventPath);
// If present remove the path's trailing slash
eventPath = _strip_trailing_slash_from_path(eventPath);
SCEvent *event = [SCEvent eventWithEventId:(NSUInteger)eventIds[i]
eventDate:[NSDate date]
eventPath:(NSString *)eventPath
eventFlags:(SCEventFlags)eventFlags[i]];
eventDate:[NSDate date]
eventPath:(NSString *)eventPath
eventFlags:(SCEventFlags)eventFlags[i]];
if ([[pathWatcher delegate] conformsToProtocol:@protocol(SCEventListenerProtocol)]) {
[[pathWatcher delegate] pathWatcher:pathWatcher eventOccurred:event];
}
Loading
Loading
@@ -397,11 +402,11 @@ static void _events_callback(ConstFSEventStreamRef streamRef,
*/
static CFStringRef _strip_trailing_slash_from_path(CFStringRef path)
{
NSString *string = (NSString *)path;
NSString *string = (NSString *)path;
 
NSUInteger length = [string length];
return (length > 1 && [string hasSuffix:@"/"]) ? (CFStringRef)[string substringToIndex:length - 1] : path;
NSUInteger length = [string length];
return (length > 1 && [string hasSuffix:@"/"]) ? (CFStringRef)[string substringToIndex:length - 1] : path;
}
 
@end
Loading
Loading
@@ -7201,7 +7201,7 @@
0464AB0C006CD2EC7F000001 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0810;
LastUpgradeCheck = 0900;
TargetAttributes = {
1D6ED85219AEA20D005A7799 = {
DevelopmentTeam = H7V7XYVQ7D;
Loading
Loading
@@ -8959,12 +8959,18 @@
ASSETCATALOG_COMPILER_APPICON_NAME = iTerm2;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ENABLE_CODE_COVERAGE = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Loading
Loading
@@ -10312,12 +10318,18 @@
ASSETCATALOG_COMPILER_APPICON_NAME = iTerm2;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ENABLE_CODE_COVERAGE = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Loading
Loading
@@ -10354,12 +10366,18 @@
ASSETCATALOG_COMPILER_APPICON_NAME = iTerm2;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ENABLE_CODE_COVERAGE = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Loading
Loading
@@ -26,8 +26,9 @@
buildConfiguration = "Development"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
enableAddressSanitizer = "YES">
enableAddressSanitizer = "YES"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
Loading
Loading
@@ -61,11 +62,12 @@
buildConfiguration = "Development"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableAddressSanitizer = "YES"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
enableAddressSanitizer = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
Loading
Loading
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Loading
Loading
@@ -26,6 +26,7 @@
buildConfiguration = "Development"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Loading
Loading
@@ -55,6 +56,7 @@
buildConfiguration = "Development"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Loading
Loading
Loading
Loading
@@ -326,6 +326,6 @@ typedef NS_ENUM(NSUInteger, iTermUnicodeNormalization) {
// Removes the profile from the model, removes key mappings that reference this profile, and posts a
// kProfileWasDeletedNotification notification, then flushes the model to backing store.
+ (BOOL)removeProfile:(Profile *)profile fromModel:(ProfileModel *)model;
+ (void)performBlockWithCoalescedNotifications:(void (^)())block;
+ (void)performBlockWithCoalescedNotifications:(void (^)(void))block;
 
@end
Loading
Loading
@@ -747,7 +747,7 @@ static NSMutableArray<NSNotification *> *sDelayedNotifications;
}
}
 
+ (void)performBlockWithCoalescedNotifications:(void (^)())block {
+ (void)performBlockWithCoalescedNotifications:(void (^)(void))block {
if (!sDelayedNotifications) {
sDelayedNotifications = [[NSMutableArray alloc] init];
 
Loading
Loading
Loading
Loading
@@ -188,6 +188,6 @@ int OffsetOfWrappedLine(screen_char_t* p, int n, int length, int width, BOOL may
- (int)numberOfTrailingEmptyLines;
 
// Call this only before a line block has been created.
void EnableDoubleWidthCharacterLineCache();
void EnableDoubleWidthCharacterLineCache(void);
 
@end
Loading
Loading
@@ -92,8 +92,7 @@ void EnableDoubleWidthCharacterLineCache() {
- (void)commonInit {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
if ([iTermAdvancedSettingsModel dwcLineCache] ||
[NSBundle it_isNightlyBuild]) {
if ([iTermAdvancedSettingsModel dwcLineCache]) {
gEnableDoubleWidthCharacterLineCache = YES;
gUseCachingNumberOfLines = YES;
}
Loading
Loading
@@ -569,19 +568,6 @@ int OffsetOfWrappedLine(screen_char_t* p, int n, int length, int width, BOOL may
if (metadata->width_for_number_of_wrapped_lines == width &&
metadata->number_of_wrapped_lines > 0) {
spans = metadata->number_of_wrapped_lines;
#warning Remove this when I feel confident it is correct
if (arc4random_uniform(100) < 10) {
// Correctness checking code follows. Remove this for speed when I think it's correct.
int referenceSpans = NumberOfFullLines(buffer_start + prev,
length,
width,
_mayHaveDoubleWidthCharacter);
if (spans != referenceSpans) {
ILog(@"Metadata gives number of wrapped lines = %@ for width %@ while reference = %@", @(metadata->number_of_wrapped_lines), @(width), @(referenceSpans));
assert(false);
}
}
} else {
spans = NumberOfFullLines(buffer_start + prev,
length,
Loading
Loading
@@ -610,15 +596,6 @@ int OffsetOfWrappedLine(screen_char_t* p, int n, int length, int width, BOOL may
bufferLength:length
width:width
metadata:&metadata_[i]];
#warning Remove this when I feel confident it is correct
if (arc4random_uniform(100) < 10) {
int correctOffset = OffsetOfWrappedLine(buffer_start + prev,
*lineNum,
length,
width,
_mayHaveDoubleWidthCharacter);
assert(offset == correctOffset);
}
} else {
offset = OffsetOfWrappedLine(buffer_start + prev,
*lineNum,
Loading
Loading
This diff is collapsed.
Loading
Loading
@@ -45,7 +45,7 @@
// _delayedPerform.canceled = YES;
// _delayedPerform = nil;
// }
- (iTermDelayedPerform *)performBlock:(void (^)())block afterDelay:(NSTimeInterval)delay;
- (iTermDelayedPerform *)performBlock:(void (^)(void))block afterDelay:(NSTimeInterval)delay;
 
// Returns nil if this object is an instance of NSNull, otherwise returns self.
- (instancetype)nilIfNull;
Loading
Loading
Loading
Loading
@@ -44,7 +44,7 @@
waitUntilDone:NO];
}
 
- (iTermDelayedPerform *)performBlock:(void (^)())block afterDelay:(NSTimeInterval)delay {
- (iTermDelayedPerform *)performBlock:(void (^)(void))block afterDelay:(NSTimeInterval)delay {
[self retain];
iTermDelayedPerform *delayedPerform = [[iTermDelayedPerform alloc] init];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC)),
Loading
Loading
Loading
Loading
@@ -9124,6 +9124,7 @@ ITERM_WEAKLY_REFERENCEABLE
 
case ITMNotificationType_NotifyOnNewSession:
case ITMNotificationType_NotifyOnTerminateSession:
case ITMNotificationType_NotifyOnLayoutChange:
// We won't get called for this
assert(NO);
break;
Loading
Loading
Loading
Loading
@@ -3609,10 +3609,10 @@ static void SetAgainstGrainDim(BOOL isVertical, NSSize *dest, CGFloat value) {
// This computes what to do and returns a block that actually does it. But if
// it's not allowed, then it returns null. This combines the "can move" with
// the "move" into a single function.
- (void (^)())blockToMoveView:(NSView *)view
inSplit:(NSView *)possibleSplit
horizontally:(BOOL)horizontally
by:(int)direction {
- (void (^)(void))blockToMoveView:(NSView *)view
inSplit:(NSView *)possibleSplit
horizontally:(BOOL)horizontally
by:(int)direction {
if (![possibleSplit isKindOfClass:[PTYSplitView class]] ||
possibleSplit.subviews.count == 1) {
return NULL;
Loading
Loading
@@ -3672,7 +3672,7 @@ static void SetAgainstGrainDim(BOOL isVertical, NSSize *dest, CGFloat value) {
}
 
// It would be ok to move the divider. Return a block that updates views' frames.
void (^block)() = ^void() {
void (^block)(void) = ^void() {
[self splitView:split draggingWillBeginOfSplit:splitterIndex];
before.frame = beforeFrame;
after.frame = afterFrame;
Loading
Loading
@@ -3686,10 +3686,10 @@ static void SetAgainstGrainDim(BOOL isVertical, NSSize *dest, CGFloat value) {
inSplit:(NSView *)possibleSplit
horizontally:(BOOL)horizontally
by:(int)direction {
void (^block)() = [self blockToMoveView:view
inSplit:possibleSplit
horizontally:horizontally
by:direction];
void (^block)(void) = [self blockToMoveView:view
inSplit:possibleSplit
horizontally:horizontally
by:direction];
if (block) {
block();
}
Loading
Loading
@@ -3699,10 +3699,10 @@ static void SetAgainstGrainDim(BOOL isVertical, NSSize *dest, CGFloat value) {
inSplit:(NSView *)possibleSplit
horizontally:(BOOL)horizontally
by:(int)direction {
void (^block)() = [self blockToMoveView:view
inSplit:possibleSplit
horizontally:horizontally
by:direction];
void (^block)(void) = [self blockToMoveView:view
inSplit:possibleSplit
horizontally:horizontally
by:direction];
return block != nil;
}
 
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