Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • karan_m/iterm2
  • zhaochangqing/iterm2
  • joykeeper/iterm2
  • nleroux/iterm2
  • kenji21/iterm2
  • gagasegsegsegeg/iterm2
  • stanhu/iterm2
  • ivyfan/iterm2
  • DAddYE/iterm2
  • trave801/iterm2
  • lordrings/iterm2
  • tweekmonster/iterm2
  • imardaras/iterm2
  • DabeDotCom/iterm2
  • sherifamin83/iterm2
  • aquarecif/iterm2
  • visualrobots/iterm2
  • xmarianox/iterm2
  • doomsayer13/iterm2
  • vikdutt/iterm2
  • me36/iterm2
  • DevGrohl/iterm2
  • manigandan-rajasekar/iterm2
  • DWoodiwiss/iterm2
  • vti/iterm2
  • DamonQin/iterm2
26 results
Show changes
Showing
with 68 additions and 127 deletions
Loading
Loading
@@ -95,7 +95,8 @@ typedef enum {
VT100CSI_RESET_MODIFIERS, // CSI > Ps n (Set all modifiers values to -1, disabled)
VT100CSI_DECSLRM, // Set left-right margin
VT100CSI_DECRQCRA, // Request Checksum of Rectangular Area
VT100CSI_REP, // Repeat
// some xterm extensions
XTERMCC_WIN_TITLE, // Set window title
XTERMCC_ICON_TITLE,
Loading
Loading
Loading
Loading
@@ -160,6 +160,7 @@ static iTermObjectPool *gPool;
@(VT100CSI_DECDSR): @"VT100CSI_DECDSR",
@(VT100CSI_SET_MODIFIERS): @"VT100CSI_SET_MODIFIERS",
@(VT100CSI_RESET_MODIFIERS): @"VT100CSI_RESET_MODIFIERS",
@(VT100CSI_REP): @"VT100CSI_REP",
@(VT100CSI_DECSLRM): @"VT100CSI_DECSLRM",
@(XTERMCC_WIN_TITLE): @"XTERMCC_WIN_TITLE",
@(XTERMCC_ICON_TITLE): @"XTERMCC_ICON_TITLE",
Loading
Loading
Loading
Loading
@@ -84,7 +84,7 @@
+ (BOOL)optionIsMetaForSpecialChars;
 
+ (BOOL)startDebugLoggingAutomatically;
+ (BOOL)aboutToPasteTabs;
+ (BOOL)aboutToPasteTabsWithCancel;
 
+ (BOOL)alwaysAcceptFirstMouse;
 
Loading
Loading
@@ -197,5 +197,6 @@
+ (BOOL)sensitiveScrollWheel;
+ (BOOL)disableCustomBoxDrawing;
+ (BOOL)useExperimentalFontMetrics;
+ (BOOL)supportREPCode;
 
@end
Loading
Loading
@@ -236,7 +236,7 @@ DEFINE_BOOL(noSyncSuppressCaptureOutputToolNotVisibleWarning, NO,
@"Warnings: Suppress warning that the Captured Output tool is not visible.");
DEFINE_BOOL(closingTmuxWindowKillsTmuxWindows, NO, @"Warnings: Suppress kill/hide dialog when closing a tmux window.");
DEFINE_BOOL(closingTmuxTabKillsTmuxWindows, NO, @"Warnings: Suppress kill/hide dialog when closing a tmux tab.");
DEFINE_BOOL(aboutToPasteTabs, NO, @"Warnings: Suppress warning about pasting tabs with offer to convert them to spaces.");
DEFINE_BOOL(aboutToPasteTabsWithCancel, NO, @"Warnings: Suppress warning about pasting tabs with offer to convert them to spaces.");
DEFINE_FLOAT(shortLivedSessionDuration, 3, @"Warnings: Warn about short-lived sessions that live less than this many seconds.");
 
DEFINE_SETTABLE_BOOL(noSyncDoNotWarnBeforeMultilinePaste, NoSyncDoNotWarnBeforeMultilinePaste, NO, @"Warnings: Suppress warning about multi-line pastes (or a single line ending in a newline).\nThis applies whether you are at the shell prompt or not, provided two or more lines are being pasted.");
Loading
Loading
@@ -287,5 +287,9 @@ DEFINE_BOOL(killSessionsOnLogout, NO, @"Experimental Features: Kill sessions on
DEFINE_BOOL(experimentalKeyHandling, NO, @"General: Improved support for input method editors like AquaSKK.");
 
DEFINE_BOOL(useExperimentalFontMetrics, NO, @"Experimental Features: Use a more theoretically correct technique to measure line height.\nYou must restart iTerm2 or adjust a session's font size for this change to take effect.");
#if BETA
DEFINE_BOOL(supportREPCode, YES, @"Experimental Features: Enable support for REP (Repeat previous character) escape sequence?");
#else
DEFINE_BOOL(supportREPCode, NO, @"Experimental Features: Enable support for REP (Repeat previous character) escape sequence?");
#endif
@end
Loading
Loading
@@ -6,7 +6,7 @@
#import "iTermEventTap.h"
#import "NSArray+iTerm.h"
 
static const CGEventFlags kCGEventHotKeyModifierMask = (kCGEventFlagMaskAlphaShift |
static const CGEventFlags kCGEventHotKeyModifierMask = (kCGEventFlagMaskShift |
kCGEventFlagMaskAlternate |
kCGEventFlagMaskCommand |
kCGEventFlagMaskControl);
Loading
Loading
@@ -212,7 +212,7 @@ ITERM_WEAKLY_REFERENCEABLE
 
switch (self.modifierActivation) {
case iTermHotKeyModifierActivationShift:
return maskedFlags == kCGEventFlagMaskAlphaShift;
return maskedFlags == kCGEventFlagMaskShift;
case iTermHotKeyModifierActivationOption:
return maskedFlags == kCGEventFlagMaskAlternate;
Loading
Loading
//
// iTermCallWithTimeout.h
// iTerm2SharedARC
//
// Created by George Nachman on 10/7/17.
//
#import <Foundation/Foundation.h>
@interface iTermCallWithTimeout : NSObject
+ (instancetype)instanceForIdentifier:(NSString *)identifier;
- (BOOL)executeWithTimeout:(NSTimeInterval)timeout
block:(void (^)(void))block;
@end
//
// iTermCallWithTimeout.m
// iTerm2SharedARC
//
// Created by George Nachman on 10/7/17.
//
#import "iTermCallWithTimeout.h"
@implementation iTermCallWithTimeout {
dispatch_queue_t _queue;
}
+ (instancetype)instanceForIdentifier:(NSString *)identifier {
static NSMutableDictionary *objects;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
objects = [NSMutableDictionary dictionary];
});
iTermCallWithTimeout *object = objects[identifier];
if (object == nil) {
object = [[self alloc] initWithIdentifier:identifier];
objects[identifier] = object;
}
return object;
}
- (instancetype)initWithIdentifier:(NSString *)identifier {
self = [super init];
if (self) {
_queue = dispatch_queue_create([[NSString stringWithFormat:@"com.iterm2.timeoutcall.%@", identifier] UTF8String],
NULL);
}
return self;
}
- (BOOL)executeWithTimeout:(NSTimeInterval)timeout block:(void (^)(void))block {
dispatch_group_t group = dispatch_group_create();
dispatch_group_enter(group);
dispatch_async(_queue, ^{
block();
dispatch_group_leave(group);
});
// Wait up to half a second for the statfs to finish.
long timedOut = dispatch_group_wait(group,
dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)));
return !!timedOut;
}
@end
Loading
Loading
@@ -368,16 +368,24 @@ static iTermController *gSharedInstance;
NSMutableArray *terminalArrangements = [NSMutableArray arrayWithCapacity:[_terminalWindows count]];
if (allWindows) {
for (PseudoTerminal *terminal in _terminalWindows) {
[terminalArrangements addObject:[terminal arrangement]];
NSDictionary *arrangement = [terminal arrangement];
if (arrangement) {
[terminalArrangements addObject:arrangement];
}
}
} else {
PseudoTerminal *currentTerminal = [self currentTerminal];
if (!currentTerminal) {
return;
}
[terminalArrangements addObject:[currentTerminal arrangement]];
NSDictionary *arrangement = [currentTerminal arrangement];
if (arrangement) {
[terminalArrangements addObject:arrangement];
}
}
if (terminalArrangements.count) {
[WindowArrangements setArrangement:terminalArrangements withName:name];
}
[WindowArrangements setArrangement:terminalArrangements withName:name];
}
 
- (void)tryOpenArrangement:(NSDictionary *)terminalArrangement {
Loading
Loading
Loading
Loading
@@ -8,7 +8,6 @@
 
#import "iTermLSOF.h"
 
#import "iTermCallWithTimeout.h"
#import "iTermSocketAddress.h"
#import "ProcessCache.h"
#include <arpa/inet.h>
Loading
Loading
@@ -19,11 +18,7 @@
#include <sys/sysctl.h>
 
int iTermProcPidInfoWrapper(int pid, int flavor, uint64_t arg, void *buffer, int buffersize) {
__block int result;
BOOL timeout = [[iTermCallWithTimeout instanceForIdentifier:@"pidinfo"] executeWithTimeout:0.5 block:^{
result = proc_pidinfo(pid, flavor, arg, buffer, buffersize);
}];
return timeout ? -1 : result;
return proc_pidinfo(pid, flavor, arg, buffer, buffersize);
}
 
@implementation iTermLSOF {
Loading
Loading
Loading
Loading
@@ -37,6 +37,7 @@ static BOOL sAuthenticated;
NSArray *_accounts;
NSString *_passwordBeingShown;
NSInteger _rowForPasswordBeingShown;
NSString *_accountNameToSelectAfterAuthentication;
}
 
+ (NSArray *)accountNamesWithFilter:(NSString *)filter {
Loading
Loading
@@ -153,6 +154,7 @@ static BOOL sAuthenticated;
 
- (void)dealloc {
[_accounts release];
[_accountNameToSelectAfterAuthentication release];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
Loading
Loading
@@ -190,6 +192,9 @@ static BOOL sAuthenticated;
if (index != NSNotFound) {
[_tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:index]
byExtendingSelection:NO];
} else if (!sAuthenticated) {
[_accountNameToSelectAfterAuthentication autorelease];
_accountNameToSelectAfterAuthentication = [name copy];
}
}
 
Loading
Loading
@@ -231,6 +236,7 @@ static BOOL sAuthenticated;
if (sAuthenticated) {
NSInteger selectedRow = [_tableView selectedRow];
NSString *selectedAccountName = [self accountNameForRow:selectedRow];
[_tableView reloadData];
[[self keychain] deletePasswordForService:kServiceName account:selectedAccountName];
[self reloadAccounts];
[self passwordsDidChange];
Loading
Loading
@@ -351,7 +357,13 @@ static BOOL sAuthenticated;
 
if (success) {
[self reloadAccounts];
[[self window] makeFirstResponder:_searchField];
if (_accountNameToSelectAfterAuthentication) {
[self selectAccountName:_accountNameToSelectAfterAuthentication];
[_accountNameToSelectAfterAuthentication release];
_accountNameToSelectAfterAuthentication = nil;
} else {
[[self window] makeFirstResponder:_searchField];
}
} else {
[self closeOrEndSheet];
}
Loading
Loading
@@ -458,6 +470,9 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
if (!sAuthenticated) {
return;
}
if (rowIndex < 0 || rowIndex >= _accounts.count) {
ITCriticalError(NO, @"Row index %@ out of bounds [0, %@)", @(rowIndex), @(_accounts.count));
}
NSString *accountName = [self accountNameForRow:rowIndex];
if (aTableColumn == _accountNameColumn) {
NSError *error = nil;
Loading
Loading
Loading
Loading
@@ -48,8 +48,7 @@ extern NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey;
- (NSString *)getFullPath:(NSString *)path
workingDirectory:(NSString *)workingDirectory
lineNumber:(NSString **)lineNumber
columnNumber:(NSString **)columnNumber
timedOut:(BOOL *)timedOut;
columnNumber:(NSString **)columnNumber;
 
// Opens the file at the relative |path| (which may include :lineNumber) in |workingDirectory|.
// The |substitutions| dictionary is used to expand \references in the command to run (gotten from
Loading
Loading
Loading
Loading
@@ -43,10 +43,9 @@ NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey = @"semanticHist
@synthesize prefs = prefs_;
@synthesize delegate = delegate_;
 
- (BOOL)fileExistsAtPathLocally:(NSString *)path timedOut:(BOOL *)timedOut {
- (BOOL)fileExistsAtPathLocally:(NSString *)path {
return [self.fileManager fileExistsAtPathLocally:path
additionalNetworkPaths:[[iTermAdvancedSettingsModel pathsToIgnore] componentsSeparatedByString:@","]
timedOut:timedOut];
additionalNetworkPaths:[[iTermAdvancedSettingsModel pathsToIgnore] componentsSeparatedByString:@","]];
}
 
- (BOOL)fileHasForbiddenPrefix:(NSString *)path {
Loading
Loading
@@ -57,10 +56,8 @@ NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey = @"semanticHist
- (NSString *)getFullPath:(NSString *)path
workingDirectory:(NSString *)workingDirectory
lineNumber:(NSString **)lineNumber
columnNumber:(NSString **)columnNumber
timedOut:(BOOL *)timedOut {
columnNumber:(NSString **)columnNumber {
DLog(@"Check if %@ is a valid path in %@", path, workingDirectory);
*timedOut = NO;
NSString *origPath = path;
// TODO(chendo): Move regex, define capture semantics in config file/prefs
if (!path || [path length] == 0) {
Loading
Loading
@@ -107,7 +104,7 @@ NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey = @"semanticHist
// be stat()ed, although they were always stat()ed because of unintentional
// disk access in the old code.
 
if ([self fileExistsAtPathLocally:path timedOut:timedOut]) {
if ([self fileExistsAtPathLocally:path]) {
DLog(@" YES: A file exists at %@", path);
NSURL *url = [NSURL fileURLWithPath:path];
 
Loading
Loading
@@ -120,11 +117,7 @@ NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey = @"semanticHist
return nil;
}
return path;
} else if (*timedOut) {
DLog(@" NO: timed out");
return nil;
}
// If path doesn't exist and it starts with "a/" or "b/" (from `diff`).
if ([origPath isMatchedByRegex:@"^[ab]/"]) {
DLog(@" Treating as diff path");
Loading
Loading
@@ -136,8 +129,7 @@ NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey = @"semanticHist
return [self getFullPath:origPath
workingDirectory:workingDirectory
lineNumber:lineNumber
columnNumber:columnNumber
timedOut:timedOut];
columnNumber:columnNumber];
}
 
DLog(@" NO: no valid path found");
Loading
Loading
@@ -338,11 +330,9 @@ NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey = @"semanticHist
 
BOOL isRawAction = [prefs_[kSemanticHistoryActionKey] isEqualToString:kSemanticHistoryRawCommandAction];
if (!isRawAction) {
BOOL timedOut;
path = [self getFullPath:path workingDirectory:workingDirectory
lineNumber:&lineNumber
columnNumber:&columnNumber
timedOut:&timedOut];
columnNumber:&columnNumber];
DLog(@"Not a raw action. New path is %@, line number is %@", path, lineNumber);
}
 
Loading
Loading
@@ -455,8 +445,7 @@ NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey = @"semanticHist
charsTakenFromPrefix:(int *)charsTakenFromPrefixPtr
charsTakenFromSuffix:(int *)suffixChars
trimWhitespace:(BOOL)trimWhitespace {
BOOL timedOut;
BOOL workingDirectoryIsOk = [self fileExistsAtPathLocally:workingDirectory timedOut:&timedOut];
BOOL workingDirectoryIsOk = [self fileExistsAtPathLocally:workingDirectory];
if (!workingDirectoryIsOk) {
DLog(@"Working directory %@ is a network share or doesn't exist. Not using it for context.",
workingDirectory);
Loading
Loading
@@ -519,16 +508,10 @@ NSString *const kSemanticHistoryWorkingDirectorySubstitutionKey = @"semanticHist
for (NSString *modifiedPossiblePath in [self pathsFromPath:trimmedPath byRemovingBadSuffixes:questionableSuffixes]) {
BOOL exists = NO;
if (workingDirectoryIsOk || [modifiedPossiblePath hasPrefix:@"/"]) {
BOOL timedOut = NO;
exists = ([self getFullPath:modifiedPossiblePath
workingDirectory:workingDirectory
lineNumber:NULL
columnNumber:NULL
timedOut:&timedOut] != nil);
if (timedOut) {
DLog(@"Timed out checking path %@ in %@", modifiedPossiblePath, workingDirectory);
return nil;
}
columnNumber:NULL] != nil);
}
if (exists) {
if (charsTakenFromPrefixPtr) {
Loading
Loading
Loading
Loading
@@ -198,7 +198,8 @@ static const NSTimeInterval kMaxTimeToRememberDirectories = 60 * 60 * 24 * 90;
storeType = NSInMemoryStoreType;
}
 
NSDictionary *options = @{};
NSDictionary *options = @{ NSInferMappingModelAutomaticallyOption: @YES,
NSMigratePersistentStoresAutomaticallyOption: @YES };
if (vacuum) {
options = @{ NSSQLiteManualVacuumOption: @YES };
}
Loading
Loading
Loading
Loading
@@ -1457,19 +1457,19 @@ typedef struct iTermTextColorContext {
atPoint:(NSPoint)origin
positions:(CGFloat *)stringPositions
backgroundColor:(NSColor *)backgroundColor {
NSGraphicsContext *graphicsContet = [NSGraphicsContext currentContext];
NSGraphicsContext *graphicsContext = [NSGraphicsContext currentContext];
[self drawTextOnlyAttributedStringWithoutUnderline:attributedString
atPoint:origin
positions:stringPositions
backgroundColor:backgroundColor
graphicsContext:graphicsContet
graphicsContext:graphicsContext
smear:NO];
 
__block CGContextRef maskGraphicsContext = nil;
__block CGImageRef alphaMask = nil;
NSDictionary *maskingAttributes = @{ (NSString *)kCTForegroundColorAttributeName: (id)[[NSColor colorWithSRGBRed:0 green:0 blue:0 alpha:1] CGColor] };
CGContextRef cgContext = (CGContextRef) [graphicsContet graphicsPort];
CGContextRef cgContext = (CGContextRef) [graphicsContext graphicsPort];
 
[attributedString enumerateAttribute:NSUnderlineStyleAttributeName
inRange:NSMakeRange(0, attributedString.length)
Loading
Loading
Loading
Loading
@@ -196,12 +196,10 @@
range.columnWindow = extractor.logicalWindow;
action.range = range;
 
BOOL timedOut;
action.fullPath = [semanticHistoryController getFullPath:filename
workingDirectory:workingDirectory
lineNumber:NULL
columnNumber:NULL
timedOut:&timedOut];
columnNumber:NULL];
action.workingDirectory = workingDirectory;
return action;
}
Loading
Loading
Loading
Loading
@@ -358,7 +358,7 @@ class DECSETTests(object):
escio.Write(BS)
AssertEQ(GetCursorPosition().x(), 1)
 
def doAltBuftest(self, code, altGetsClearedBeforeToMain, cursorSaved):
def doAltBuftest(self, code, altGetsClearedBeforeToMain, cursorSaved, movesCursorOnEnter=False):
"""|code| is the code to test with, either 47 or 1047."""
# Scribble in main screen
escio.Write("abc" + CR + LF + "abc")
Loading
Loading
@@ -371,8 +371,10 @@ class DECSETTests(object):
before = GetCursorPosition()
esccmd.DECSET(code)
after = GetCursorPosition()
AssertEQ(before.x(), after.x())
AssertEQ(before.y(), after.y())
if not movesCursorOnEnter:
# 1049 moves the cursor on enter
AssertEQ(before.x(), after.x())
AssertEQ(before.y(), after.y())
 
# Scribble in alt screen, clearing it first since who knows what might have
# been there.
Loading
Loading
@@ -401,8 +403,10 @@ class DECSETTests(object):
before = GetCursorPosition()
esccmd.DECSET(code)
after = GetCursorPosition()
AssertEQ(before.x(), after.x())
AssertEQ(before.y(), after.y())
if not movesCursorOnEnter:
# 1049 moves the cursor on enter
AssertEQ(before.x(), after.x())
AssertEQ(before.y(), after.y())
 
if altGetsClearedBeforeToMain:
AssertScreenCharsInRectEqual(Rect(1, 1, 3, 3), [ NUL * 3, NUL * 3, NUL * 3 ])
Loading
Loading
@@ -429,7 +433,7 @@ class DECSETTests(object):
def test_DECSET_OPT_ALTBUF_CURSOR(self):
"""DECSET 1049 is like 1047 but it also saves the cursor position before
entering alt and restores it after returning to main."""
self.doAltBuftest(esccmd.OPT_ALTBUF_CURSOR, True, True)
self.doAltBuftest(esccmd.OPT_ALTBUF_CURSOR, True, True, True)
 
# xterm doesn't implement auto-wrap mode when wide characters are disabled.
@optionRejects(terminal="xterm", option=escargs.DISABLE_WIDE_CHARS)
Loading
Loading
Loading
Loading
@@ -86,7 +86,7 @@ SVNDIR=~/iterm2-website
ORIG_DIR=`pwd`
 
 
echo "Build deployment release"
echo "Build beta release"
make clean
make Beta
 
Loading
Loading
3.1.%(extra)s
3.1.5.beta.2