From cb6712202f79cac61a36b0788475202aa7719ac3 Mon Sep 17 00:00:00 2001 From: sawka Date: Mon, 12 Dec 2022 12:26:55 -0800 Subject: [PATCH] cleanup --- src/main.tsx | 10 ++++++---- src/model.ts | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index a83058d8..76040d25 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1491,7 +1491,7 @@ class InfoRemoteEdit extends React.Component<{}, {}> { -
+
color
- {"|"} + + [archive remote] + + {"|"} + [cancel (ESC)]
diff --git a/src/model.ts b/src/model.ts index efffe932..ea1ed6d4 100644 --- a/src/model.ts +++ b/src/model.ts @@ -1562,6 +1562,22 @@ class Model { getApi().onBracketCmd(this.onBracketCmd.bind(this)); getApi().onDigitCmd(this.onDigitCmd.bind(this)); getApi().onLocalServerStatusChange(this.onLocalServerStatusChange.bind(this)); + document.addEventListener("keydown", this.docKeyDownHandler.bind(this)); + } + + docKeyDownHandler(e : any) { + if (isModKeyPress(e)) { + return; + } + if (e.code == "Escape") { + e.preventDefault(); + let inputModel = this.inputModel; + inputModel.toggleInfoMsg(); + if (inputModel.inputMode.get() != null) { + inputModel.resetInputMode(); + } + return; + } } restartLocalServer() : void { @@ -2263,11 +2279,11 @@ class CommandRunner { let kwargs = Object.assign({}, kwargsArg); kwargs["nohist"] = "1"; kwargs["remote"] = remoteid; - GlobalModel.submitCommand("remote", "edit", null, kwargs, true); + GlobalModel.submitCommand("remote", "set", null, kwargs, true); } openEditRemote(remoteid : string) : void { - GlobalModel.submitCommand("remote", "edit", null, {"remote": remoteid, "nohist": "1", "visual": "1"}, true); + GlobalModel.submitCommand("remote", "set", null, {"remote": remoteid, "nohist": "1", "visual": "1"}, true); } archiveRemote(remoteid : string) {