diff --git a/sources/PTYSession.m b/sources/PTYSession.m index e4c79d5009..5ef7ef9e0d 100644 --- a/sources/PTYSession.m +++ b/sources/PTYSession.m @@ -3826,25 +3826,25 @@ - (void)setUpdateCadence:(NSTimeInterval)cadence { return; } DLog(@"Set cadence of %@ to %f", self, cadence); -#if 0 - // TODO: Try this. It solves the bug where we don't redraw properly during live resize. - // I'm worried about the possible side effects it might have since there's no way to - // know all the tracking event loops. - _updateTimer = [NSTimer timerWithTimeInterval:MAX(kMinimumDelay, - timeout - timeSinceLastUpdate) - target:self.weakSelf - selector:@selector(updateDisplay) - userInfo:nil - repeats:YES]; - [[NSRunLoop currentRunLoop] addTimer:_updateTimer forMode:NSRunLoopCommonModes]; -#else + [_updateTimer invalidate]; - _updateTimer = [NSTimer scheduledTimerWithTimeInterval:cadence - target:self.weakSelf - selector:@selector(updateDisplay) - userInfo:nil - repeats:YES]; -#endif + if ([iTermAdvancedSettingsModel trackingRunloopForLiveResize]) { + // This solves the bug where we don't redraw properly during live resize. + // I'm worried about the possible side effects it might have since there's no way to + // know all the tracking event loops. + _updateTimer = [NSTimer timerWithTimeInterval:kActiveUpdateCadence + target:self.weakSelf + selector:@selector(updateDisplay) + userInfo:nil + repeats:YES]; + [[NSRunLoop currentRunLoop] addTimer:_updateTimer forMode:NSRunLoopCommonModes]; + } else { + _updateTimer = [NSTimer scheduledTimerWithTimeInterval:cadence + target:self.weakSelf + selector:@selector(updateDisplay) + userInfo:nil + repeats:YES]; + } } - (void)doAntiIdle { diff --git a/sources/iTermAdvancedSettingsModel.h b/sources/iTermAdvancedSettingsModel.h index adb900338d..f8fa313eee 100644 --- a/sources/iTermAdvancedSettingsModel.h +++ b/sources/iTermAdvancedSettingsModel.h @@ -170,5 +170,6 @@ + (BOOL)noSyncSuppressMissingProfileInArrangementWarning; + (void)setNoSyncSuppressMissingProfileInArrangementWarning:(BOOL)value; + (BOOL)acceptOSC7; ++ (BOOL)trackingRunloopForLiveResize; @end diff --git a/sources/iTermAdvancedSettingsModel.m b/sources/iTermAdvancedSettingsModel.m index 6fa3c29982..f57bed9814 100644 --- a/sources/iTermAdvancedSettingsModel.m +++ b/sources/iTermAdvancedSettingsModel.m @@ -256,5 +256,6 @@ + (NSString *)name { \ DEFINE_BOOL(useLayers, NO, @"Experimental Features: Use Core Animation layers for opaque terminal views"); DEFINE_BOOL(acceptOSC7, YES, @"Experimental Features: Accept OSC 7 to set username, hostname, and path."); +DEFINE_BOOL(trackingRunloopForLiveResize, YES, @"Experimental Features: Use a tracking runloop for live resizing."); @end