Merge pull request #2817 from Tyriar/2764

Pause cursor render layer before resuming
This commit is contained in:
Daniel Imms
2020-04-10 06:25:30 -07:00
committed by GitHub
2 changed files with 10 additions and 4 deletions
@@ -302,7 +302,7 @@ class CursorBlinkStateManager {
// the regular interval is setup in order to support restarting the blink // the regular interval is setup in order to support restarting the blink
// animation in a lightweight way (without thrashing clearInterval and // animation in a lightweight way (without thrashing clearInterval and
// setInterval). // setInterval).
this._blinkStartTimeout = <number><any>setTimeout(() => { this._blinkStartTimeout = window.setTimeout(() => {
// Check if another animation restart was requested while this was being // Check if another animation restart was requested while this was being
// started // started
if (this._animationTimeRestarted) { if (this._animationTimeRestarted) {
@@ -322,7 +322,7 @@ class CursorBlinkStateManager {
}); });
// Setup the blink interval // Setup the blink interval
this._blinkInterval = <number><any>setInterval(() => { this._blinkInterval = window.setInterval(() => {
// Adjust the animation time if it was restarted // Adjust the animation time if it was restarted
if (this._animationTimeRestarted) { if (this._animationTimeRestarted) {
// calc time diff // calc time diff
@@ -360,6 +360,9 @@ class CursorBlinkStateManager {
} }
public resume(terminal: Terminal): void { public resume(terminal: Terminal): void {
// Clear out any existing timers just in case
this.pause();
this._animationTimeRestarted = undefined; this._animationTimeRestarted = undefined;
this._restartInterval(); this._restartInterval();
this.restartBlinkAnimation(terminal); this.restartBlinkAnimation(terminal);
+5 -2
View File
@@ -306,7 +306,7 @@ class CursorBlinkStateManager {
// the regular interval is setup in order to support restarting the blink // the regular interval is setup in order to support restarting the blink
// animation in a lightweight way (without thrashing clearInterval and // animation in a lightweight way (without thrashing clearInterval and
// setInterval). // setInterval).
this._blinkStartTimeout = <number><any>setTimeout(() => { this._blinkStartTimeout = window.setTimeout(() => {
// Check if another animation restart was requested while this was being // Check if another animation restart was requested while this was being
// started // started
if (this._animationTimeRestarted) { if (this._animationTimeRestarted) {
@@ -326,7 +326,7 @@ class CursorBlinkStateManager {
}); });
// Setup the blink interval // Setup the blink interval
this._blinkInterval = <number><any>setInterval(() => { this._blinkInterval = window.setInterval(() => {
// Adjust the animation time if it was restarted // Adjust the animation time if it was restarted
if (this._animationTimeRestarted) { if (this._animationTimeRestarted) {
// calc time diff // calc time diff
@@ -364,6 +364,9 @@ class CursorBlinkStateManager {
} }
public resume(): void { public resume(): void {
// Clear out any existing timers just in case
this.pause();
this._animationTimeRestarted = undefined; this._animationTimeRestarted = undefined;
this._restartInterval(); this._restartInterval();
this.restartBlinkAnimation(); this.restartBlinkAnimation();