From 152db7407514bdabde7b68ba5de4d8352a798498 Mon Sep 17 00:00:00 2001 From: sawka Date: Fri, 26 Aug 2022 17:50:15 -0700 Subject: [PATCH] add merge to Screen object --- src/model.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/model.ts b/src/model.ts index 417999b3a..2194b2aae 100644 --- a/src/model.ts +++ b/src/model.ts @@ -181,6 +181,24 @@ class Screen { } 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) {