working on line selection / fg commands

This commit is contained in:
sawka 2022-10-07 01:08:52 -07:00
parent 271dde4d1d
commit ab31aecf90
3 changed files with 32 additions and 3 deletions

View File

@ -281,6 +281,15 @@ class ScreenWindow {
this.setScrollTop_debounced = debounce(1000, this.setScrollTop.bind(this)); this.setScrollTop_debounced = debounce(1000, this.setScrollTop.bind(this));
} }
updateSelf(swdata : ScreenWindowType) {
mobx.action(() => {
this.name.set(swdata.name);
this.layout.set(swdata.layout);
this.selectedLine.set(swdata.selectedline);
// do not set scrolltop!
})();
}
setScrollTop(scrollTop : number) : void { setScrollTop(scrollTop : number) : void {
GlobalCommandRunner.swSetScrollTop(this.sessionId, this.screenId, this.windowId, scrollTop); GlobalCommandRunner.swSetScrollTop(this.sessionId, this.screenId, this.windowId, scrollTop);
} }
@ -1444,11 +1453,11 @@ class Model {
} }
onMetaArrowUp() : void { onMetaArrowUp() : void {
GlobalCommandRunner.swSelectLine("-"); GlobalCommandRunner.swSelectLine("-1");
} }
onMetaArrowDown() : void { onMetaArrowDown() : void {
GlobalCommandRunner.swSelectLine("+"); GlobalCommandRunner.swSelectLine("+1");
} }
onMetaArrowUpOld() : void { onMetaArrowUpOld() : void {
@ -1635,6 +1644,9 @@ class Model {
if ("window" in update) { if ("window" in update) {
this.updateWindow(update.window, false); this.updateWindow(update.window, false);
} }
if ("screenwindow" in update) {
this.updateSW(update.screenwindow);
}
if ("remotes" in update) { if ("remotes" in update) {
if (update.connect) { if (update.connect) {
this.remotes.clear(); this.remotes.clear();
@ -1715,6 +1727,14 @@ class Model {
})(); })();
} }
updateSW(swdata : ScreenWindowType) {
let sw = this.getSWByIds(swdata.sessionid, swdata.screenid, swdata.windowid);
if (sw == null) {
return;
}
sw.updateSelf(swdata);
}
getScreenById(sessionId : string, screenId : string) : Screen { getScreenById(sessionId : string, screenId : string) : Screen {
let session = this.getSessionById(sessionId); let session = this.getSessionById(sessionId);
if (session == null) { if (session == null) {
@ -1748,6 +1768,14 @@ class Model {
return screen.getSW(windowId); return screen.getSW(windowId);
} }
getSWByIds(sessionId : string, screenId : string, windowId : string) : ScreenWindow {
let screen = this.getScreenById(sessionId, screenId);
if (screen == null) {
return null;
}
return screen.getSW(windowId);
}
getActiveScreen() : Screen { getActiveScreen() : Screen {
let session = this.getActiveSession(); let session = this.getActiveSession();
if (session == null) { if (session == null) {

View File

@ -446,7 +446,7 @@ html, body, #main {
align-self: flex-start; align-self: flex-start;
&.focus { &.focus {
box-shadow: 0 0 3px 3px rgba(255, 255, 255, 0.3); /* box-shadow: 0 0 3px 3px rgba(255, 255, 255, 0.3); */
} }
} }
} }

View File

@ -261,6 +261,7 @@ type ModelUpdateType = {
sessions? : SessionDataType[], sessions? : SessionDataType[],
activesessionid? : string, activesessionid? : string,
window? : WindowDataType, window? : WindowDataType,
screenwindow? : ScreenWindowType,
line? : LineType, line? : LineType,
cmd? : CmdDataType, cmd? : CmdDataType,
info? : InfoType, info? : InfoType,