diff --git a/src/model.ts b/src/model.ts index 17777ba0..955089ab 100644 --- a/src/model.ts +++ b/src/model.ts @@ -2275,11 +2275,15 @@ class RemotesModalModel { } closeModal() : void { + if (!this.openState.get()) { + return; + } mobx.action(() => { this.openState.set(false); this.selectedRemoteId.set(null); this.remoteEdit.set(null); })(); + setTimeout(() => GlobalModel.refocus(), 10); } disposeTerm() : void { @@ -2448,6 +2452,14 @@ class Model { getApi().reloadWindow(); } + refocus() { // givefocus() give back focus to cmd or input + let activeScreen = this.getActiveScreen(); + if (screen == null) { + return; + } + activeScreen.giveFocus(); + } + getHasClientStop() : boolean { if (this.clientData.get() == null) { return true;