Skip to content
Snippets Groups Projects
Commit 58eec843 authored by George Nachman's avatar George Nachman Committed by GitHub
Browse files

Merge branch 'master' into master

parents 10e4937b 0e3ae7b5
No related branches found
No related tags found
No related merge requests found
Showing
with 106 additions and 32 deletions
Loading
Loading
@@ -8,7 +8,6 @@ if ls /tmp/failed-* 1> /dev/null 2>&1; then
export PATH=$PATH:$PWD/tests
cd /tmp
source /tmp/diffs > diffs.txt
tar cvfz failed-images.tgz failed-*.png diffs.txt accept.sh
/usr/bin/curl -k -F "file=@failed-images.tgz" https://file.io
tar cvfz - failed-*.png diffs.txt accept.sh | base64 -b 80
fi
 
Loading
Loading
@@ -233,8 +233,9 @@ extern NSString *const iTermUnicodeVersionDidChangeNotification;
// Minimum time between sending anti-idle codes. "1" otherwise results in a flood.
extern const NSTimeInterval kMinimumAntiIdlePeriod;
 
// Special value for KEY_SPACE.
extern NSInteger iTermProfileJoinsAllSpaces;
// Special values for KEY_SPACE.
extern const NSInteger iTermProfileJoinsAllSpaces;
extern const NSInteger iTermProfileOpenInCurrentSpace;
 
// The numerical values for each enum matter because they are used in
// the UI as "tag" values for each select list item. They are also
Loading
Loading
Loading
Loading
@@ -45,7 +45,9 @@
NSString *const iTermUnicodeVersionDidChangeNotification = @"iTermUnicodeVersionDidChangeNotification";
 
const NSTimeInterval kMinimumAntiIdlePeriod = 1.0;
NSInteger iTermProfileJoinsAllSpaces = -1;
const NSInteger iTermProfileJoinsAllSpaces = -1;
const NSInteger iTermProfileOpenInCurrentSpace = 0;
static NSMutableArray<NSNotification *> *sDelayedNotifications;
 
@implementation ITAddressBookMgr {
Loading
Loading
Loading
Loading
@@ -185,7 +185,7 @@ static NSString *const kHotkeyWindowGeneratedProfileNameKey = @"Hotkey Window";
dict[KEY_BLUR_RADIUS] = @2.0;
dict[KEY_BLUR] = @YES;
dict[KEY_SCREEN] = @-1;
dict[KEY_SPACE] = @-1;
dict[KEY_SPACE] = @(iTermProfileJoinsAllSpaces);
dict[KEY_SHORTCUT] = @"";
NSString *newProfileName = kHotkeyWindowGeneratedProfileNameKey;
NSInteger number = 1;
Loading
Loading
Loading
Loading
@@ -79,6 +79,14 @@
}
}
 
- (NSAppearance *)effectiveAppearance {
if ([self.window.appearance.name isEqual:NSAppearanceNameVibrantDark]) {
return [NSAppearance appearanceNamed:NSAppearanceNameVibrantLight];
} else {
return [super effectiveAppearance];
}
}
- (BOOL)isLegacyScroller
{
return [self scrollerStyle] == NSScrollerStyleLegacy;
Loading
Loading
Loading
Loading
@@ -81,6 +81,9 @@ extern NSString *const iTermDidDecodeWindowRestorableStateNotification;
// called yet.
@property(nonatomic) BOOL restorableStateDecodePending;
 
// Used only by hotkey windows. Indicate if it should move to the active space when opening.
@property(nonatomic, readonly) BOOL openInCurrentSpace;
// Draws a mock-up of a window arrangement into the current graphics context.
// |frames| gives an array of NSValue's having NSRect values for each screen,
// giving the screens' coordinates in the model.
Loading
Loading
Loading
Loading
@@ -2264,9 +2264,10 @@ ITERM_WEAKLY_REFERENCEABLE
}
 
Profile* addressbookEntry = [[[[[self tabs] objectAtIndex:0] sessions] objectAtIndex:0] profile];
if ([addressbookEntry objectForKey:KEY_SPACE] &&
[[addressbookEntry objectForKey:KEY_SPACE] intValue] == iTermProfileJoinsAllSpaces) {
if ([addressbookEntry[KEY_SPACE] intValue] == iTermProfileJoinsAllSpaces) {
[[self window] setCollectionBehavior:[[self window] collectionBehavior] | NSWindowCollectionBehaviorCanJoinAllSpaces];
} else if ([addressbookEntry[KEY_SPACE] intValue] == iTermProfileOpenInCurrentSpace) {
_openInCurrentSpace = YES;
}
if ([arrangement objectForKey:TERMINAL_GUID] &&
[[arrangement objectForKey:TERMINAL_GUID] isKindOfClass:[NSString class]]) {
Loading
Loading
@@ -7475,9 +7476,10 @@ ITERM_WEAKLY_REFERENCEABLE
 
// On Lion, a window that can join all spaces can't go fullscreen.
if ([self numberOfTabs] == 1 &&
profile[KEY_SPACE] &&
[profile[KEY_SPACE] intValue] == iTermProfileJoinsAllSpaces) {
[[self window] setCollectionBehavior:[[self window] collectionBehavior] | NSWindowCollectionBehaviorCanJoinAllSpaces];
} else if ([profile[KEY_SPACE] intValue] == iTermProfileOpenInCurrentSpace) {
_openInCurrentSpace = YES;
}
 
return aSession;
Loading
Loading
Loading
Loading
@@ -179,5 +179,7 @@
+ (BOOL)excludeBackgroundColorsFromCopiedStyle;
+ (BOOL)useGCDUpdateTimer;
+ (BOOL)fullHeightCursor;
+ (BOOL)drawOutlineAroundCursor;
+ (double)underlineCursorOffset;
 
@end
Loading
Loading
@@ -128,6 +128,7 @@ DEFINE_BOOL(focusReportingEnabled, YES, @"Terminal: Apps may turn on Focus Repor
DEFINE_BOOL(useColorfgbgFallback, YES, @"Terminal: Use fallback for COLORFGBG if no exact match found?\nThe COLORFGBG variable indicates the ANSI colors that match the foreground and background colors. If no colors match and this setting is enabled, then the variable will be set to 15;0 to indicate a dark background or 0;15 to indicate a light background.");
DEFINE_BOOL(zeroWidthSpaceAdvancesCursor, YES, @"Terminal: Zero-Width Space (U+200B) advances cursor?\nWhile a zero-width space should not advance the cursor per the Unicode spec, both Terminal.app and Konsole do this, and Weechat depends on it. You must restart iTerm2 after changing this setting.");
DEFINE_BOOL(fullHeightCursor, NO, @"Terminal: Cursor occupies line spacing area.\nIf lines have more than 100% vertical spacing and this setting is enabled the bottom of the cursor will be aligned to the bottom of the spacing area.");
DEFINE_FLOAT(underlineCursorOffset, 0, @"Terminal: Vertical offset for underline cursor.\nPositive values move it up, negative values move it down.");
 
#pragma mark Hotkey
DEFINE_FLOAT(hotkeyTermAnimationDuration, 0.25, @"Hotkey: Duration in seconds of the hotkey window animation.\nWarning: reducing this value may cause problems if you have multiple displays.");
Loading
Loading
@@ -265,5 +266,6 @@ DEFINE_BOOL(trackingRunloopForLiveResize, YES, @"Experimental Features: Use a tr
 
DEFINE_BOOL(enableAPIServer, NO, @"Experimental Features: Enable websocket API server.\nYou must restart iTerm2 for this change to take effect.");
DEFINE_BOOL(useGCDUpdateTimer, NO, @"Experimental Features: Use GCD-based update timer instead of NSTimer.\nThis should cause more regular screen updates. Restart iTerm2 after changing this setting.");
DEFINE_BOOL(drawOutlineAroundCursor, NO, @"Experimental Features: Draw outline around underline and vertical bar cursors using background color.");
 
@end
Loading
Loading
@@ -880,8 +880,8 @@ static iTermController *gSharedInstance;
}
 
+ (void)switchToSpaceInBookmark:(Profile *)aDict {
if ([aDict objectForKey:KEY_SPACE]) {
int spaceNum = [[aDict objectForKey:KEY_SPACE] intValue];
if (aDict[KEY_SPACE]) {
int spaceNum = [aDict[KEY_SPACE] intValue];
if (spaceNum > 0 && spaceNum < 10) {
// keycodes for digits 1-9. Send control-n to switch spaces.
// TODO: This would get remapped by the event tap. It requires universal access to be on and
Loading
Loading
Loading
Loading
@@ -48,7 +48,7 @@ typedef struct {
smart:(BOOL)smart
focused:(BOOL)focused
coord:(VT100GridCoord)coord
cellHeight:(CGFloat)cellHeight;
outline:(BOOL)outline;
 
 
@end
Loading
Loading
@@ -47,7 +47,18 @@
smart:(BOOL)smart
focused:(BOOL)focused
coord:(VT100GridCoord)coord
cellHeight:(CGFloat)cellHeight {
outline:(BOOL)outline {
}
- (void)drawOutlineOfRect:(NSRect)cursorRect withColor:(NSColor *)color {
[[color colorWithAlphaComponent:0.75] set];
NSRect rect = cursorRect;
CGFloat frameWidth = 0.5;
rect.origin.x -= frameWidth;
rect.origin.y -= frameWidth;
rect.size.width += frameWidth * 2;
rect.size.height += frameWidth * 2;
NSFrameRectWithWidthUsingOperation(rect, 0.5, NSCompositeSourceOver);
}
 
@end
Loading
Loading
@@ -62,12 +73,18 @@
smart:(BOOL)smart
focused:(BOOL)focused
coord:(VT100GridCoord)coord
cellHeight:(CGFloat)cellHeight {
[backgroundColor set];
NSRectFill(NSMakeRect(rect.origin.x,
rect.origin.y + rect.size.height - 2,
ceil(rect.size.width),
2));
outline:(BOOL)outline {
const CGFloat height = 2;
NSRect cursorRect = NSMakeRect(rect.origin.x,
rect.origin.y + rect.size.height - height - [iTermAdvancedSettingsModel underlineCursorOffset],
ceil(rect.size.width),
height);
if (outline) {
[self drawOutlineOfRect:cursorRect withColor:backgroundColor];
} else {
[backgroundColor set];
NSRectFill(cursorRect);
}
}
 
@end
Loading
Loading
@@ -82,9 +99,14 @@
smart:(BOOL)smart
focused:(BOOL)focused
coord:(VT100GridCoord)coord
cellHeight:(CGFloat)cellHeight {
[backgroundColor set];
NSRectFill(NSMakeRect(rect.origin.x, rect.origin.y, 1, rect.size.height));
outline:(BOOL)outline {
NSRect cursorRect = NSMakeRect(rect.origin.x, rect.origin.y, 1, rect.size.height);
if (outline) {
[self drawOutlineOfRect:cursorRect withColor:backgroundColor];
} else {
[backgroundColor set];
NSRectFill(cursorRect);
}
}
 
@end
Loading
Loading
@@ -99,7 +121,9 @@
smart:(BOOL)smart
focused:(BOOL)focused
coord:(VT100GridCoord)coord
cellHeight:(CGFloat)cellHeight {
outline:(BOOL)outline {
assert(!outline);
// Draw the colored box/frame
if (smart) {
iTermCursorNeighbors neighbors = [self.delegate cursorNeighbors];
Loading
Loading
Loading
Loading
@@ -70,6 +70,7 @@
- (void)dealloc {
[_attributedString release];
[_attributes release];
[_characterData release];
[_string release];
[super dealloc];
}
Loading
Loading
Loading
Loading
@@ -571,6 +571,15 @@ static NSString *const kArrangement = @"Arrangement";
if (self.windowController.weaklyReferencedObject) {
DLog(@"already have a hotkey window created");
if (self.windowController.window.alphaValue == 1) {
if (self.windowController.openInCurrentSpace && !self.windowController.window.isOnActiveSpace) {
DLog(@"Move already-open hotkey window to current space");
NSWindow *window = self.windowController.window;
// I tested this on 10.12 and it's sufficient to move the window. Maybe not in older OS versions?
NSWindowCollectionBehavior collectionBehavior = window.collectionBehavior;
window.collectionBehavior = (collectionBehavior | NSWindowCollectionBehaviorCanJoinAllSpaces);
window.collectionBehavior = collectionBehavior;
return;
}
DLog(@"hotkey window opaque");
if (!allSiblingsOpen) {
DLog(@"Not all siblings open. Doing nothing.");
Loading
Loading
@@ -610,7 +619,7 @@ static NSString *const kArrangement = @"Arrangement";
 
- (iTermHotkeyWindowType)hotkeyWindowType {
if (self.floats) {
if ([iTermProfilePreferences unsignedIntegerForKey:KEY_SPACE inProfile:self.profile] == iTermProfileJoinsAllSpaces) {
if ([iTermProfilePreferences intForKey:KEY_SPACE inProfile:self.profile] == iTermProfileJoinsAllSpaces) {
// This makes it possible to overlap Lion fullscreen windows.
return iTermHotkeyWindowTypeFloatingPanel;
} else {
Loading
Loading
Loading
Loading
@@ -265,7 +265,7 @@ NSString *const kProfilePreferenceInitialDirectoryAdvancedValue = @"Advanced";
KEY_HIDE_AFTER_OPENING: @NO,
KEY_WINDOW_TYPE: @(WINDOW_TYPE_NORMAL),
KEY_SCREEN: @-1,
KEY_SPACE: @0,
KEY_SPACE: @(iTermProfileOpenInCurrentSpace),
KEY_SYNC_TITLE: @NO,
KEY_DISABLE_WINDOW_RESIZING: @NO,
KEY_PREVENT_TAB: @NO,
Loading
Loading
Loading
Loading
@@ -371,7 +371,7 @@ typedef struct iTermTextColorContext {
 
const BOOL drawCursorBeforeText = (_cursorType == CURSOR_UNDERLINE || _cursorType == CURSOR_VERTICAL);
if (drawCursorBeforeText) {
[self drawCursor];
[self drawCursor:NO];
}
 
// Now iterate over the lines and paint the characters.
Loading
Loading
@@ -410,8 +410,12 @@ typedef struct iTermTextColorContext {
cursorHeight:_cellSizeWithoutSpacing.height
ctx:ctx];
_blinkingFound |= self.cursorBlinking;
if (!drawCursorBeforeText) {
[self drawCursor];
if (drawCursorBeforeText) {
if ([iTermAdvancedSettingsModel drawOutlineAroundCursor]) {
[self drawCursor:YES];
}
} else {
[self drawCursor:NO];
}
}
 
Loading
Loading
@@ -2224,8 +2228,21 @@ static BOOL iTermTextDrawingHelperIsCharacterDrawable(screen_char_t *c,
}
}
 
- (void)drawCursor {
DLog(@"drawCursor");
- (NSRect)cursorFrameIncludingDoubleWidthAdjustment {
screen_char_t *theLine = [self.delegate drawingHelperLineAtScreenIndex:_cursorCoord.y];
BOOL isDoubleWidth;
[self charForCursorAtColumn:_cursorCoord.x
inLine:theLine
doubleWidth:&isDoubleWidth];
NSRect rect = [self cursorFrame];
if (isDoubleWidth) {
rect.size.width *= 2;
}
return rect;
}
- (void)drawCursor:(BOOL)outline {
DLog(@"drawCursor:%@", @(outline));
 
// Update the last time the cursor moved.
NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
Loading
Loading
@@ -2246,7 +2263,11 @@ static BOOL iTermTextDrawingHelperIsCharacterDrawable(screen_char_t *c,
 
// Get the color of the cursor.
NSColor *cursorColor;
cursorColor = [self backgroundColorForCursor];
if (outline) {
cursorColor = [_colorMap colorForKey:kColorMapBackground];
} else {
cursorColor = [self backgroundColorForCursor];
}
NSRect rect = [self cursorFrame];
if (isDoubleWidth) {
rect.size.width *= 2;
Loading
Loading
@@ -2274,7 +2295,7 @@ static BOOL iTermTextDrawingHelperIsCharacterDrawable(screen_char_t *c,
smart:_useSmartCursorColor
focused:((_isInKeyWindow && _textViewIsActiveSession) || _shouldDrawFilledInCursor)
coord:_cursorCoord
cellHeight:_cellSize.height];
outline:outline];
if (_showSearchingCursor) {
NSImage *image = [NSImage imageNamed:@"SearchCursor"];
if (image) {
Loading
Loading
tests/Goldens/PTYTextViewTest-golden-travis-testBarCursorReverseVideo.png

3.38 KiB | W: 24px | H: 38px

tests/Goldens/PTYTextViewTest-golden-travis-testBarCursorReverseVideo.png

3.41 KiB | W: 24px | H: 38px

tests/Goldens/PTYTextViewTest-golden-travis-testBarCursorReverseVideo.png
tests/Goldens/PTYTextViewTest-golden-travis-testBarCursorReverseVideo.png
tests/Goldens/PTYTextViewTest-golden-travis-testBarCursorReverseVideo.png
tests/Goldens/PTYTextViewTest-golden-travis-testBarCursorReverseVideo.png
  • 2-up
  • Swipe
  • Onion skin
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