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

Remove the lag from updating the window title. Issue 5876

parent 90909b4a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -370,6 +370,8 @@ static NSRect iTermRectCenteredVerticallyWithinRect(NSRect frameToCenter, NSRect
// Keeps the touch bar from updating on every keypress which is distracting.
iTermRateLimitedUpdate *_touchBarRateLimitedUpdate;
NSString *_previousTouchBarWord;
BOOL _windowWasJustCreated;
}
 
+ (void)registerSessionsInArrangement:(NSDictionary *)arrangement {
Loading
Loading
@@ -457,6 +459,15 @@ static NSRect iTermRectCenteredVerticallyWithinRect(NSRect frameToCenter, NSRect
screenNumber,
@(hotkeyWindowType));
 
_windowWasJustCreated = YES;
PseudoTerminal<iTermWeakReference> *weakSelf = self.weakSelf;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
PseudoTerminal *strongSelf = weakSelf.weaklyReferencedObject;
if (strongSelf != nil) {
strongSelf->_windowWasJustCreated = NO;
}
});
// Force the nib to load
[self window];
_screenNumberFromFirstProfile = screenNumber;
Loading
Loading
@@ -1645,12 +1656,21 @@ ITERM_WEAKLY_REFERENCEABLE
// seems to be relatively slow, so we don't want to spend too much time doing that if the
// terminal goes nuts and sends lots of title-change sequences.
BOOL hadTimer = (self.desiredTitle != nil);
if (![self.window.title isEqualToString:title]) {
NSLog(@"Change title to %@", title);
}
self.desiredTitle = title;
if (!hadTimer) {
if (!_windowWasJustCreated) {
// Unless the window was just created, set the title immediately. Issue 5876.
self.window.title = self.desiredTitle;
}
PseudoTerminal<iTermWeakReference> *weakSelf = self.weakSelf;
static const NSTimeInterval kSetTitleDelay = 0.1;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(kSetTitleDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
weakSelf.window.title = weakSelf.desiredTitle;
if (!(weakSelf.window.title == weakSelf.desiredTitle || [weakSelf.window.title isEqualToString:weakSelf.desiredTitle])) {
weakSelf.window.title = weakSelf.desiredTitle;
}
weakSelf.desiredTitle = 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