From 9c32f690c6ab028e5b2785871b1917bb8e0cbbdb Mon Sep 17 00:00:00 2001 From: sawka Date: Wed, 13 Mar 2024 11:57:49 -0700 Subject: [PATCH] sync shell state when you switch to a new tab --- src/models/commandrunner.ts | 4 ++++ src/models/model.ts | 3 +++ wavesrv/pkg/cmdrunner/cmdrunner.go | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/models/commandrunner.ts b/src/models/commandrunner.ts index 98150ccee..5b57a0c4d 100644 --- a/src/models/commandrunner.ts +++ b/src/models/commandrunner.ts @@ -304,6 +304,10 @@ class CommandRunner { GlobalModel.clientSettingsViewModel.showClientSettingsView(); } + syncShellState() { + GlobalModel.submitCommand("sync", null, null, { nohist: "1" }, false); + } + historyView(params: HistorySearchParams) { let kwargs = { nohist: "1" }; kwargs["offset"] = String(params.offset); diff --git a/src/models/model.ts b/src/models/model.ts index 15af1ae58..eb254c253 100644 --- a/src/models/model.ts +++ b/src/models/model.ts @@ -1086,6 +1086,9 @@ class Model { this.activeMainView.set("session"); this.deactivateScreenLines(); this.ws.watchScreen(newActiveSessionId, newActiveScreenId); + setTimeout(() => { + GlobalCommandRunner.syncShellState(); + }, 100); } } else { console.warn("unknown update", genUpdate); diff --git a/wavesrv/pkg/cmdrunner/cmdrunner.go b/wavesrv/pkg/cmdrunner/cmdrunner.go index 446309f6e..dbe8c051b 100644 --- a/wavesrv/pkg/cmdrunner/cmdrunner.go +++ b/wavesrv/pkg/cmdrunner/cmdrunner.go @@ -493,7 +493,7 @@ func getEvalDepth(ctx context.Context) int { func SyncCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (scbus.UpdatePacket, error) { ids, err := resolveUiIds(ctx, pk, R_Session|R_Screen|R_RemoteConnected) if err != nil { - return nil, fmt.Errorf("/run error: %w", err) + return nil, fmt.Errorf("/sync error: %w", err) } runPacket := packet.MakeRunPacket() runPacket.ReqId = uuid.New().String()