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));
}
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 {
GlobalCommandRunner.swSetScrollTop(this.sessionId, this.screenId, this.windowId, scrollTop);
}
@ -1444,11 +1453,11 @@ class Model {
}
onMetaArrowUp() : void {
GlobalCommandRunner.swSelectLine("-");
GlobalCommandRunner.swSelectLine("-1");
}
onMetaArrowDown() : void {
GlobalCommandRunner.swSelectLine("+");
GlobalCommandRunner.swSelectLine("+1");
}
onMetaArrowUpOld() : void {
@ -1635,6 +1644,9 @@ class Model {
if ("window" in update) {
this.updateWindow(update.window, false);
}
if ("screenwindow" in update) {
this.updateSW(update.screenwindow);
}
if ("remotes" in update) {
if (update.connect) {
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 {
let session = this.getSessionById(sessionId);
if (session == null) {
@ -1748,6 +1768,14 @@ class Model {
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 {
let session = this.getActiveSession();
if (session == null) {

View File

@ -446,7 +446,7 @@ html, body, #main {
align-self: flex-start;
&.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[],
activesessionid? : string,
window? : WindowDataType,
screenwindow? : ScreenWindowType,
line? : LineType,
cmd? : CmdDataType,
info? : InfoType,