diff --git a/src/main.tsx b/src/main.tsx
index c50367dd..3e8e5eec 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -2284,6 +2284,10 @@ class MainSideBar extends React.Component<{}, {}> {
activeRemoteId = rptr.remoteid;
}
}
+ let sw : ScreenWindow = null;
+ if (GlobalModel.debugSW.get()) {
+ sw = GlobalModel.getActiveSW();
+ }
let session : Session = null;
let remotes = model.remotes ?? [];
let remote : RemoteType = null;
@@ -2350,6 +2354,13 @@ class MainSideBar extends React.Component<{}, {}> {
+
+
+ focus={sw.focusType.get()}
+ sline={sw.selectedLine.get()}
+ termfocus={sw.termLineNumFocus.get()}
+
+
this.clickRemotes()}>Remotes
diff --git a/src/model.ts b/src/model.ts
index b558c689..7cf24a50 100644
--- a/src/model.ts
+++ b/src/model.ts
@@ -16,6 +16,12 @@ const RemotePtyCols = 80;
const MinTermCols = 10;
const MaxTermCols = 1024;
+type SWLinePtr = {
+ line : LineType,
+ win : Window,
+ sw : ScreenWindow,
+};
+
function widthToCols(width : number) : number {
let cols = Math.trunc((width - 32) / DefaultCellWidth) - 1;
cols = boundInt(cols, MinTermCols, MaxTermCols);
@@ -224,13 +230,6 @@ class Screen {
})();
}
- updatePtyData(ptyMsg : PtyDataUpdateType) {
- for (let i=0; i this.termLineNumFocus.set(focus ? lineNum : 0))();
if (focus && this.selectedLine.get() != lineNum) {
GlobalCommandRunner.swSelectLine(String(lineNum), "cmd");
}
+ else if (focus && this.focusType.get() == "input") {
+ GlobalCommandRunner.swSetFocus("cmd");
+ }
}
connectElem(elem : Element, line : LineType, cmd : Cmd, width : number) {
@@ -740,6 +743,17 @@ class Session {
}
return null;
}
+
+ getSWs(windowId : string) : ScreenWindow[] {
+ let rtn : ScreenWindow[] = [];
+ for (let screen of this.screens) {
+ let sw = screen.getSW(windowId);
+ if (sw != null) {
+ rtn.push(sw);
+ }
+ }
+ return rtn;
+ }
}
function getDefaultHistoryQueryOpts() : HistoryQueryOpts {
@@ -863,10 +877,12 @@ class InputModel {
mobx.action(() => {
this.physicalInputFocused.set(isFocused);
})();
- let sw = GlobalModel.getActiveSW();
- if (sw != null) {
- if (sw.focusType.get() != "input") {
- GlobalCommandRunner.swSetFocus("input");
+ if (isFocused) {
+ let sw = GlobalModel.getActiveSW();
+ if (sw != null) {
+ if (sw.focusType.get() != "input") {
+ GlobalCommandRunner.swSetFocus("input");
+ }
}
}
}
@@ -1419,7 +1435,8 @@ class Model {
termUsedRowsCache : Record = {};
remotesModalOpen : OV = mobx.observable.box(false);
addRemoteModalOpen : OV = mobx.observable.box(false);
- debugCmds : boolean = false;
+ debugCmds : number = 0;
+ debugSW : OV = mobx.observable.box(false);
constructor() {
this.clientId = getApi().getId();
@@ -1611,11 +1628,7 @@ class Model {
let ptyMsg : PtyDataUpdateType = genUpdate;
if (isBlank(ptyMsg.remoteid)) {
// regular update
- let activeScreen = this.getActiveScreen();
- if (!activeScreen || activeScreen.sessionId != ptyMsg.sessionid) {
- return;
- }
- activeScreen.updatePtyData(ptyMsg);
+ this.updatePtyData(ptyMsg);
return;
}
else {
@@ -1829,8 +1842,11 @@ class Model {
}
submitCommandPacket(cmdPk : FeCmdPacketType, interactive : boolean) {
- if (this.debugCmds) {
+ if (this.debugCmds > 0) {
console.log("[cmd]", cmdPacketString(cmdPk));
+ if (this.debugCmds > 1) {
+ console.trace();
+ }
}
let url = sprintf("http://localhost:8080/api/run-command");
fetch(url, {method: "post", body: JSON.stringify(cmdPk)}).then((resp) => handleJsonFetchResponse(url, resp)).then((data) => {
@@ -1963,6 +1979,47 @@ class Model {
return window.getCmd(line.cmdid);
}
+ getActiveLinesByCmdId(sessionid : string, cmdid : string) : SWLinePtr[] {
+ let rtn : SWLinePtr[] = [];
+ let session = this.getSessionById(sessionid);
+ if (session == null) {
+ return [];
+ }
+ for (let win of this.windows.values()) {
+ if (win.sessionId != sessionid) {
+ continue;
+ }
+ if (!win.loaded.get()) {
+ continue;
+ }
+ let cmd = win.getCmd(cmdid);
+ if (cmd == null) {
+ continue;
+ }
+ let winLine : LineType = null;
+ for (let i=0; i