From 509ae8d32ee3ec112e3071f16b560d9dcdb79df4 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Fri, 27 May 2022 14:44:49 +0200 Subject: [PATCH] fixed spinner handling - fixes #6489, fixes #6476, fixes #3383 --- .../src/api/baseTerminalTab.component.ts | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tabby-terminal/src/api/baseTerminalTab.component.ts b/tabby-terminal/src/api/baseTerminalTab.component.ts index 9f9fa734..73cb5eb9 100644 --- a/tabby-terminal/src/api/baseTerminalTab.component.ts +++ b/tabby-terminal/src/api/baseTerminalTab.component.ts @@ -138,6 +138,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit }, }) private spinnerActive = false + private spinnerPaused = false private toolbarRevealTimeout = new ResettableTimeout(() => { this.revealToolbar = false }, 1000) @@ -760,7 +761,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit } protected startSpinner (text?: string): void { - if (this.spinnerActive) { + if (this.spinnerActive || this.spinnerPaused) { return } if (text) { @@ -782,11 +783,19 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit } protected async withSpinnerPaused (work: () => any): Promise { - const wasActive = this.spinnerActive - this.stopSpinner() - await work() - if (wasActive) { - this.startSpinner() + this.spinnerPaused = true + if (this.spinnerActive) { + this.spinner.stop(true) + } + try { + await work() + } finally { + this.spinnerPaused = false + if (this.spinnerActive) { + this.zone.runOutsideAngular(() => { + this.spinner.start() + }) + } } }