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

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

parents e497fd30 78cba9be
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -7199,7 +7199,7 @@
DevelopmentTeam = H7V7XYVQ7D;
};
874206460564169600CFC3F1 = {
DevelopmentTeam = H7V7XYVQ7D;
DevelopmentTeam = CMC4EL7UVS;
ProvisioningStyle = Automatic;
};
A66717851DCE36C3000CE608 = {
Loading
Loading
@@ -8980,7 +8980,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -10161,7 +10161,7 @@
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -10230,7 +10230,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = YES;
DEVELOPMENT_TEAM = H7V7XYVQ7D;
DEVELOPMENT_TEAM = CMC4EL7UVS;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
Loading
Loading
@@ -5710,7 +5710,7 @@ ITERM_WEAKLY_REFERENCEABLE
break;
 
case KEY_ACTION_PASTE_SPECIAL_FROM_SELECTION: {
NSString *string = [self mostRecentlySelectedText];
NSString *string = [[iTermController sharedInstance] lastSelection];
if (string.length) {
[_pasteHelper pasteString:string
stringConfig:keyBindingText];
Loading
Loading
@@ -6489,19 +6489,8 @@ ITERM_WEAKLY_REFERENCEABLE
[[_delegate realParentWindow] restartSessionWithConfirmation:self];
}
 
- (NSString *)mostRecentlySelectedText {
PTYSession *session = [[iTermController sharedInstance] sessionWithMostRecentSelection];
if (session) {
PTYTextView *textview = [session textview];
if ([textview isAnyCharSelected]) {
return [textview selectedText];
}
}
return nil;
}
- (void)textViewPasteFromSessionWithMostRecentSelection:(PTYSessionPasteFlags)flags {
NSString *string = [self mostRecentlySelectedText];
NSString *string = [[iTermController sharedInstance] lastSelection];
if (string) {
[self pasteString:string flags:flags];
}
Loading
Loading
Loading
Loading
@@ -267,9 +267,6 @@ typedef NS_ENUM(NSInteger, PTYTextViewSelectionExtensionUnit) {
// Returns the entire content of the view as a string.
@property(nonatomic, readonly) NSString *content;
 
// Returns the time (since 1970) when the selection was last modified, or 0 if there is no selection
@property(nonatomic, readonly) NSTimeInterval selectionTime;
// Regular and non-ascii fonts.
@property(nonatomic, readonly) NSFont *font;
@property(nonatomic, readonly) NSFont *nonAsciiFont;
Loading
Loading
Loading
Loading
@@ -3703,10 +3703,11 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
[item action]==@selector(addNote:) ||
[item action]==@selector(copy:) ||
[item action]==@selector(copyWithStyles:) ||
[item action]==@selector(pasteSelection:) ||
([item action]==@selector(print:) && [item tag] == 1)) { // print selection
// These commands are allowed only if there is a selection.
return [_selection hasSelection];
} else if ([item action]==@selector(pasteSelection:)) {
return [[iTermController sharedInstance] lastSelection] != nil;
} else if ([item action]==@selector(selectOutputOfLastCommand:)) {
return [_delegate textViewCanSelectOutputOfLastCommand];
} else if ([item action]==@selector(selectCurrentCommand:)) {
Loading
Loading
@@ -6774,14 +6775,17 @@ static double EuclideanDistance(NSPoint p1, NSPoint p2) {
#pragma mark - iTermSelectionDelegate
 
- (void)selectionDidChange:(iTermSelection *)selection {
if ([selection hasSelection]) {
_selectionTime = [[NSDate date] timeIntervalSince1970];
} else {
_selectionTime = 0;
}
[_delegate refresh];
DLog(@"Update selection time to %lf. selection=%@. stack=%@",
(double)_selectionTime, selection, [NSThread callStackSymbols]);
if (!_selection.live && selection.hasSelection) {
const NSInteger MAX_SELECTION_SIZE = 10 * 1000 * 1000;
NSString *selection = [self selectedTextWithCappedAtSize:MAX_SELECTION_SIZE minimumLineNumber:0];
if (selection.length == MAX_SELECTION_SIZE) {
selection = nil;
}
[[iTermController sharedInstance] setLastSelection:selection];
}
DLog(@"Selection did change: selection=%@. stack=%@",
selection, [NSThread callStackSymbols]);
}
 
- (VT100GridRange)selectionRangeOfTerminalNullsOnLine:(int)lineNumber {
Loading
Loading
Loading
Loading
@@ -56,7 +56,6 @@ typedef NS_ENUM(NSUInteger, iTermHotkeyWindowType) {
@property(nonatomic, readonly) BOOL willRestoreWindowsAtNextLaunch;
@property(nonatomic, readonly) BOOL shouldLeaveSessionsRunningOnQuit;
@property(nonatomic, readonly) BOOL haveTmuxConnection;
@property(nonatomic, readonly, strong) PTYSession *sessionWithMostRecentSelection;
@property(nonatomic, nonatomic, assign) PseudoTerminal *currentTerminal;
@property(nonatomic, readonly) int numberOfTerminals;
@property(nonatomic, readonly) BOOL hasRestorableSession;
Loading
Loading
@@ -65,6 +64,7 @@ typedef NS_ENUM(NSUInteger, iTermHotkeyWindowType) {
@property(nonatomic, readonly) NSArray<iTermTerminalWindow *> *keyTerminalWindows;
@property(nonatomic, readonly) NSString *savedArrangementNameBeingRestored;
@property(nonatomic, readonly) NSInteger numberOfDecodesPending;
@property(nonatomic, copy) NSString *lastSelection;
 
+ (iTermController*)sharedInstance;
+ (void)releaseSharedInstance;
Loading
Loading
Loading
Loading
@@ -190,6 +190,7 @@ static iTermController *gSharedInstance;
[_restorableSessions release];
[_currentRestorableSessionsStack release];
[_fullScreenWindowManager release];
[_lastSelection release];
[super dealloc];
}
 
Loading
Loading
@@ -602,26 +603,6 @@ static iTermController *gSharedInstance;
}
}
 
- (PTYSession *)sessionWithMostRecentSelection {
NSTimeInterval latest = 0;
PTYSession *best = nil;
for (PseudoTerminal *term in [self terminals]) {
PTYTab *aTab = [term currentTab];
for (PTYSession *aSession in [aTab sessions]) {
NSTimeInterval current = [[aSession textview] selectionTime];
if (current > latest) {
latest = current;
best = aSession;
}
}
}
return best;
}
- (PseudoTerminal *)currentTerminal {
return _frontTerminalWindowController;
}
- (void)terminalWillClose:(PseudoTerminal*)theTerminalWindow {
if (_frontTerminalWindowController == theTerminalWindow) {
[self setCurrentTerminal: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