From e7ceecee5b33c3d4b4c7dded7c2e6afb508c0822 Mon Sep 17 00:00:00 2001 From: sawka Date: Fri, 7 Oct 2022 14:37:25 -0700 Subject: [PATCH] l-cmd model update --- src/model.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/model.ts b/src/model.ts index 6d8b9556..e5f432ea 100644 --- a/src/model.ts +++ b/src/model.ts @@ -72,6 +72,7 @@ type ElectronApi = { getId : () => string, onTCmd : (callback : (mods : KeyModsType) => void) => void, onICmd : (callback : (mods : KeyModsType) => void) => void, + onLCmd : (callback : (mods : KeyModsType) => void) => void, onHCmd : (callback : (mods : KeyModsType) => void) => void, onMetaArrowUp : (callback : () => void) => void, onMetaArrowDown : (callback : () => void) => void, @@ -264,6 +265,7 @@ class ScreenWindow { selectedLine : OV; scrollTop : OV; shouldFollow : OV = mobx.observable.box(true); + focusType : OV<"input"|"lines"> = mobx.observable.box("input"); // cmdid => TermWrap terms : Record = {}; @@ -290,6 +292,12 @@ class ScreenWindow { })(); } + setFocusType(ftype : "input" | "lines") : void { + mobx.action(() => { + this.focusType.set(ftype); + })(); + } + setScrollTop(scrollTop : number) : void { GlobalCommandRunner.swSetScrollTop(this.sessionId, this.screenId, this.windowId, scrollTop); } @@ -1341,6 +1349,7 @@ class Model { this.inputModel = new InputModel(); getApi().onTCmd(this.onTCmd.bind(this)); getApi().onICmd(this.onICmd.bind(this)); + getApi().onLCmd(this.onLCmd.bind(this)); getApi().onHCmd(this.onHCmd.bind(this)); getApi().onMetaArrowUp(this.onMetaArrowUp.bind(this)); getApi().onMetaArrowDown(this.onMetaArrowDown.bind(this)); @@ -1415,6 +1424,10 @@ class Model { this.inputModel.giveFocus(); } + onLCmd(e : any, mods : KeyModsType) { + this.inputModel.giveFocus(); + } + onHCmd(e : any, mods : KeyModsType) { let focusedLine = this.getFocusedLine(); if (focusedLine != null && focusedLine.cmdInputFocus) {