Skip to content
Permalink
Browse files Browse the repository at this point in the history
Fist swipe at removing DNS code
  • Loading branch information
gnachman committed Sep 20, 2017
1 parent 9eed17c commit 33ccaf6
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 226 deletions.
10 changes: 0 additions & 10 deletions iTerm2.xcodeproj/project.pbxproj
Expand Up @@ -630,7 +630,6 @@
1D6C4D5A122329F000E0AA3E /* ColorPresets.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1D6C4D59122329F000E0AA3E /* ColorPresets.plist */; };
1D6C50A71226EEFB00E0AA3E /* ProfileListView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D6C50A51226EEFB00E0AA3E /* ProfileListView.h */; };
1D6ED85619AEA20D005A7799 /* URLAction.h in Headers */ = {isa = PBXBuildFile; fileRef = A6CFDAD0185D2587005DC94B /* URLAction.h */; };
1D6ED85719AEA20D005A7799 /* AsyncHostLookupController.h in Headers */ = {isa = PBXBuildFile; fileRef = A6CFDAD5185D53C2005DC94B /* AsyncHostLookupController.h */; };
1D6ED85819AEA20D005A7799 /* LineBufferPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D78B55C183EE1C000014D49 /* LineBufferPosition.h */; };
1D6ED85919AEA20D005A7799 /* FindContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D53FD13181C4B4B00524D4F /* FindContext.h */; };
1D6ED85A19AEA20D005A7799 /* ProfilesTerminalPreferencesViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = A6A2698D1900F95D00437DA9 /* ProfilesTerminalPreferencesViewController.h */; };
Expand Down Expand Up @@ -2017,7 +2016,6 @@
A6C763011B45C52B00E3C992 /* TransferrableFileMenuItemViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A68A30D9186D1429007F550F /* TransferrableFileMenuItemViewController.m */; };
A6C763021B45C52B00E3C992 /* VT100RemoteHost.m in Sources */ = {isa = PBXBuildFile; fileRef = A68A30DA186D1429007F550F /* VT100RemoteHost.m */; };
A6C763031B45C52B00E3C992 /* VT100WorkingDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = A68A30DB186D1429007F550F /* VT100WorkingDirectory.m */; };
A6C763051B45C52B00E3C992 /* AsyncHostLookupController.m in Sources */ = {isa = PBXBuildFile; fileRef = A6CFDAD6185D53C2005DC94B /* AsyncHostLookupController.m */; };
A6C763061B45C52B00E3C992 /* BackgroundThread.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DA26ABF15007507004B5792 /* BackgroundThread.m */; };
A6C763071B45C52B00E3C992 /* CapturedOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = A67F57D31B11882900B4F135 /* CapturedOutput.m */; };
A6C763091B45C52B00E3C992 /* iTermCommandHistoryCommandUseMO+Addtions.m in Sources */ = {isa = PBXBuildFile; fileRef = A6E7474C188C6394005355CF /* iTermCommandHistoryCommandUseMO+Addtions.m */; };
Expand Down Expand Up @@ -2317,7 +2315,6 @@
A6CEDA6119988A7300BB57EC /* LogoShadow.png in Resources */ = {isa = PBXBuildFile; fileRef = A6CEDA5E19988A7300BB57EC /* LogoShadow.png */; };
A6CEDA6219988A7300BB57EC /* LogoShadow.png in Resources */ = {isa = PBXBuildFile; fileRef = A6CEDA5E19988A7300BB57EC /* LogoShadow.png */; };
A6CFDAD2185D2587005DC94B /* URLAction.h in Headers */ = {isa = PBXBuildFile; fileRef = A6CFDAD0185D2587005DC94B /* URLAction.h */; };
A6CFDAD7185D53C2005DC94B /* AsyncHostLookupController.h in Headers */ = {isa = PBXBuildFile; fileRef = A6CFDAD5185D53C2005DC94B /* AsyncHostLookupController.h */; };
A6D22A431BC8BE6B004084E0 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = A6D22A411BC8BE6B004084E0 /* Model.xcdatamodeld */; };
A6D22A441BC8BE6B004084E0 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = A6D22A411BC8BE6B004084E0 /* Model.xcdatamodeld */; };
A6D22A451BC8BE6B004084E0 /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = A6D22A411BC8BE6B004084E0 /* Model.xcdatamodeld */; };
Expand Down Expand Up @@ -3837,8 +3834,6 @@
A6CEDA5E19988A7300BB57EC /* LogoShadow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = LogoShadow.png; path = images/LogoParts/LogoShadow.png; sourceTree = "<group>"; };
A6CFDAD0185D2587005DC94B /* URLAction.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = URLAction.h; sourceTree = "<group>"; tabWidth = 4; };
A6CFDAD1185D2587005DC94B /* URLAction.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = URLAction.m; sourceTree = "<group>"; tabWidth = 4; };
A6CFDAD5185D53C2005DC94B /* AsyncHostLookupController.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = AsyncHostLookupController.h; sourceTree = "<group>"; tabWidth = 4; };
A6CFDAD6185D53C2005DC94B /* AsyncHostLookupController.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = AsyncHostLookupController.m; sourceTree = "<group>"; tabWidth = 4; };
A6D22A421BC8BE6B004084E0 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
A6D22B431BC9D368004084E0 /* iTermShellHistoryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = iTermShellHistoryTest.m; sourceTree = "<group>"; };
A6DF401A1897607E00F05947 /* NSTextField+iTerm.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = "NSTextField+iTerm.h"; sourceTree = "<group>"; tabWidth = 4; };
Expand Down Expand Up @@ -4202,7 +4197,6 @@
A66DB8341C8E4CBB00233E88 /* iTermOpenQuicklyCommands.h */,
A6E7138C18F26A91008D94DD /* AppearancePreferencesViewController.h */,
1D2560A813EE60E4006B35CD /* ArrangementPreviewView.h */,
A6CFDAD5185D53C2005DC94B /* AsyncHostLookupController.h */,
1DE214DF128212EE004E3ADF /* Autocomplete.h */,
1DA26ABE15007507004B5792 /* BackgroundThread.h */,
1D9DCC0C142D7F5F0016228A /* BellTrigger.h */,
Expand Down Expand Up @@ -5630,7 +5624,6 @@
A6E761631D39D216005C0E5C /* iTermMutableAttributedStringBuilder.m */,
539325EE1DD66EF100CABCEF /* iTermPreciseTimer.h */,
539325EF1DD66EF100CABCEF /* iTermPreciseTimer.m */,
A6CFDAD6185D53C2005DC94B /* AsyncHostLookupController.m */,
1DA26ABF15007507004B5792 /* BackgroundThread.m */,
A67F57D31B11882900B4F135 /* CapturedOutput.m */,
1D53FD14181C4B4B00524D4F /* FindContext.m */,
Expand Down Expand Up @@ -6134,7 +6127,6 @@
buildActionMask = 2147483647;
files = (
1D6ED85619AEA20D005A7799 /* URLAction.h in Headers */,
1D6ED85719AEA20D005A7799 /* AsyncHostLookupController.h in Headers */,
1D6ED85819AEA20D005A7799 /* LineBufferPosition.h in Headers */,
1D6ED85919AEA20D005A7799 /* FindContext.h in Headers */,
1D6ED85A19AEA20D005A7799 /* ProfilesTerminalPreferencesViewController.h in Headers */,
Expand Down Expand Up @@ -6478,7 +6470,6 @@
buildActionMask = 2147483647;
files = (
A6CFDAD2185D2587005DC94B /* URLAction.h in Headers */,
A6CFDAD7185D53C2005DC94B /* AsyncHostLookupController.h in Headers */,
1D78B55E183EE1C000014D49 /* LineBufferPosition.h in Headers */,
A65B72781B2BF2D200F947A7 /* iTermProfilesPanel.h in Headers */,
1D53FD15181C4B4B00524D4F /* FindContext.h in Headers */,
Expand Down Expand Up @@ -8485,7 +8476,6 @@
A6C7637C1B45C52B00E3C992 /* ProfilesColorsPreferencesViewController.m in Sources */,
A6C763E21B45C6DD00E3C992 /* PSMTabDragWindow.m in Sources */,
A6936B5A1D2F5D1A00521B04 /* iTermHotkeyPreferencesModel.m in Sources */,
A6C763051B45C52B00E3C992 /* AsyncHostLookupController.m in Sources */,
A6C763DA1B45C6DD00E3C992 /* NSWindow+PSM.m in Sources */,
A6C763121B45C52B00E3C992 /* iTermImageInfo.m in Sources */,
A6C7636E1B45C52B00E3C992 /* iTermPreferences.m in Sources */,
Expand Down
25 changes: 0 additions & 25 deletions sources/AsyncHostLookupController.h

This file was deleted.

119 changes: 0 additions & 119 deletions sources/AsyncHostLookupController.m

This file was deleted.

66 changes: 2 additions & 64 deletions sources/PTYTextView.m
@@ -1,6 +1,5 @@
#import "PTYTextView.h"

#import "AsyncHostLookupController.h"
#import "charmaps.h"
#import "FileTransferManager.h"
#import "FontSizeEstimator.h"
Expand Down Expand Up @@ -96,10 +95,6 @@
static const NSUInteger kRectangularSelectionModifiers = (NSCommandKeyMask | NSAlternateKeyMask);
static const NSUInteger kRectangularSelectionModifierMask = (kRectangularSelectionModifiers | NSControlKeyMask);

// Notifications posted when hostname lookups finish. Notifications are used to
// avoid dangling references.
static NSString *const kHostnameLookupFailed = @"kHostnameLookupFailed";
static NSString *const kHostnameLookupSucceeded = @"kHostnameLookupSucceeded";
static PTYTextView *gCurrentKeyEventTextView; // See comment in -keyDown:

// Minimum distance that the mouse must move before a cmd+drag will be
Expand All @@ -119,9 +114,6 @@ @interface PTYTextView () <
NSMenuDelegate,
NSPopoverDelegate>

// Set the hostname this view is currently waiting for AsyncHostLookupController to finish looking
// up.
@property(nonatomic, copy) NSString *currentUnderlineHostname;
@property(nonatomic, retain) iTermSelection *selection;
@property(nonatomic, retain) iTermSemanticHistoryController *semanticHistoryController;
@property(nonatomic, retain) iTermFindCursorView *findCursorView;
Expand Down Expand Up @@ -309,14 +301,6 @@ - (instancetype)initWithFrame:(NSRect)aRect colorMap:(iTermColorMap *)colorMap {
selector:@selector(_pointerSettingsChanged:)
name:kPointerPrefsChangedNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(hostnameLookupFailed:)
name:kHostnameLookupFailed
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(hostnameLookupSucceeded:)
name:kHostnameLookupSucceeded
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(imageDidLoad:)
name:iTermImageDidLoad
Expand Down Expand Up @@ -400,10 +384,6 @@ - (void)dealloc {
[threeFingerTapGestureRecognizer_ disconnectTarget];
[threeFingerTapGestureRecognizer_ release];

if (self.currentUnderlineHostname) {
[[AsyncHostLookupController sharedInstance] cancelRequestForHostname:self.currentUnderlineHostname];
}
[_currentUnderlineHostname release];
_indicatorsHelper.delegate = nil;
[_indicatorsHelper release];
_selectionScrollHelper.delegate = nil;
Expand Down Expand Up @@ -1115,7 +1095,6 @@ - (void)drawRect:(NSRect)rect {
// Draw the cursor filled in when we're inactive if there's a popup open or key focus was stolen.
_drawingHelper.shouldDrawFilledInCursor = ([self.delegate textViewShouldDrawFilledInCursor] || _keyFocusStolenCount);
_drawingHelper.isFrontTextView = (self == [[iTermController sharedInstance] frontTextView]);
_drawingHelper.haveUnderlinedHostname = (self.currentUnderlineHostname != nil);
_drawingHelper.transparencyAlpha = [self transparencyAlpha];
_drawingHelper.now = [NSDate timeIntervalSinceReferenceDate];
_drawingHelper.drawMarkIndicators = [_delegate textViewShouldShowMarkIndicators];
Expand Down Expand Up @@ -1772,10 +1751,6 @@ - (void)removeUnderline {
}
_drawingHelper.underlinedRange =
VT100GridAbsWindowedRangeMake(VT100GridAbsCoordRangeMake(-1, -1, -1, -1), 0, 0);
if (self.currentUnderlineHostname) {
[[AsyncHostLookupController sharedInstance] cancelRequestForHostname:self.currentUnderlineHostname];
}
self.currentUnderlineHostname = nil;
[self setNeedsDisplay:YES]; // It would be better to just display the underlined/formerly underlined area.
}

Expand Down Expand Up @@ -1809,29 +1784,9 @@ - (URLAction *)updateUnderlinedURLs:(NSEvent *)event {

if (action.actionType == kURLActionOpenURL) {
NSURL *url = [NSURL URLWithUserSuppliedString:action.string];
if (![url.host isEqualToString:self.currentUnderlineHostname]) {
if (self.currentUnderlineHostname) {
[[AsyncHostLookupController sharedInstance] cancelRequestForHostname:self.currentUnderlineHostname];
}
if (url && url.host) {
self.currentUnderlineHostname = url.host;
[[AsyncHostLookupController sharedInstance] getAddressForHost:url.host
completion:^(BOOL ok, NSString *hostname) {
if (!ok) {
[[NSNotificationCenter defaultCenter] postNotificationName:kHostnameLookupFailed
object:hostname];
} else {
[[NSNotificationCenter defaultCenter] postNotificationName:kHostnameLookupSucceeded
object:hostname];
}
}];
}
if (url && url.host) {
[self setNeedsDisplay:YES];
}
} else {
if (self.currentUnderlineHostname) {
[[AsyncHostLookupController sharedInstance] cancelRequestForHostname:self.currentUnderlineHostname];
}
self.currentUnderlineHostname = nil;
}
} else {
[self removeUnderline];
Expand Down Expand Up @@ -6188,23 +6143,6 @@ - (URLAction *)urlActionForClickAtX:(int)x
}];
}

- (void)hostnameLookupFailed:(NSNotification *)notification {
if ([[notification object] isEqualToString:self.currentUnderlineHostname]) {
self.currentUnderlineHostname = nil;
[self removeUnderline];
_drawingHelper.underlinedRange =
VT100GridAbsWindowedRangeMake(VT100GridAbsCoordRangeMake(-1, -1, -1, -1), 0, 0);
[self setNeedsDisplay:YES];
}
}

- (void)hostnameLookupSucceeded:(NSNotification *)notification {
if ([[notification object] isEqualToString:self.currentUnderlineHostname]) {
self.currentUnderlineHostname = nil;
[self setNeedsDisplay:YES];
}
}

- (void)imageDidLoad:(NSNotification *)notification {
if ([self imageIsVisible:notification.object]) {
[self setNeedsDisplay:YES];
Expand Down
1 change: 0 additions & 1 deletion sources/iTermAdvancedSettingsModel.h
Expand Up @@ -161,7 +161,6 @@
+ (BOOL)useColorfgbgFallback;
+ (BOOL)promptForPasteWhenNotAtPrompt;
+ (void)setPromptForPasteWhenNotAtPrompt:(BOOL)value;
+ (BOOL)performDNSLookups;
+ (BOOL)zeroWidthSpaceAdvancesCursor;
+ (BOOL)darkThemeHasBlackTitlebar;
+ (BOOL)fontChangeAffectsBroadcastingSessions;
Expand Down

0 comments on commit 33ccaf6

Please sign in to comment.