Skip to content

Commit

Permalink
Enable the tracking runloop for live resize. Issue 3706
Browse files Browse the repository at this point in the history
  • Loading branch information
gnachman committed Jan 4, 2017
1 parent f42a232 commit f819ed6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
36 changes: 18 additions & 18 deletions sources/PTYSession.m
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions sources/iTermAdvancedSettingsModel.h
Expand Up @@ -170,5 +170,6 @@
+ (BOOL)noSyncSuppressMissingProfileInArrangementWarning;
+ (void)setNoSyncSuppressMissingProfileInArrangementWarning:(BOOL)value;
+ (BOOL)acceptOSC7;
+ (BOOL)trackingRunloopForLiveResize;

@end
1 change: 1 addition & 0 deletions sources/iTermAdvancedSettingsModel.m
Expand Up @@ -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

4 comments on commit f819ed6

@stuartcarnie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnachman, heads up that your concerns of side effects was warranted – the cursor does not update properly when cursor repeating left / right on the command prompt. Disabling this experimental feature resolves the issue

@gnachman
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when cursor repeating left / right on the command prompt

What do you mean by "cursor repeating left / right"? Can you give me more details about how to reproduce what you see?

@stuartcarnie
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if it wasn't clear, I meant when you hold the left or right cursor key down and the onscreen block cursor usually animates between each character until you release the key. With this on, it only appears when you release the cursor key or it reaches the beginning/ end of the line depending on direction

@gnachman
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that's a problem. Fixed by commit 6c41394.

Please sign in to comment.