add merge to Screen object

This commit is contained in:
sawka 2022-08-26 17:50:15 -07:00
parent c3d3647111
commit 152db74075

View File

@ -181,6 +181,24 @@ class Screen {
} }
mergeData(data : ScreenDataType) { mergeData(data : ScreenDataType) {
if (data.sessionid != this.sessionId || data.screenid != this.screenId) {
throw new Error("invalid screen update, ids don't match")
}
mobx.action(() => {
if (data.screenidx != 0) {
this.screenIdx.set(data.screenidx);
}
if (data.screenopts != null) {
this.opts.set(data.screenopts);
}
if (!isBlank(data.name)) {
this.name.set(data.name);
}
if (!isBlank(data.activewindowid)) {
this.activeWindowId.set(data.activewindowid);
}
// TODO merge windows
})();
} }
updatePtyData(ptyMsg : PtyDataUpdateType) { updatePtyData(ptyMsg : PtyDataUpdateType) {