You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐞 Terminal State is not saved when switching tabs #923
@lukepistrol That's because whenever the tabs are switched the updateNSView() function is fired it saves the terminal state. But SwiftTerm doesn't save the state, if you want to I could create an issue and tag the developer.
@iggy890SwiftTerm is not supposed to save anything. The problem lies in somewhere in our implementation because at some point the SwiftTerm view gets deallocated (released from memory) and then reallocated while the saved state is not applied for some reason. Nothing to do with SwiftTerm.
Yeah I am going to take a look at this and see why the saved state does not get added to the new view, I have done some experimenting and I think I can find a solution.
is reinitializing terminals every time the view loads and should be changed to something like
.onAppear { if model.terminals.isEmpty { initializeTerminals() } }
With this change, any terminal views you have open will be restored with env variables intact, but, seemingly unrelatedly, the buffer will be reset to a fresh prompt without previous commands and output, like pressing ⌘K. I investigated this for an embarrassingly long time and don't understand why that's happening.
Activity
austincondiff commentedon Feb 16, 2023
Might be related to #917 and @Code-DJ's PR #984
iggy890 commentedon Mar 7, 2023
I've looked into this and it seems that it's a SwiftTerm bug.
lukepistrol commentedon Mar 7, 2023
@iggy890 what exactly brings you to this conclusion?
iggy890 commentedon Mar 7, 2023
@lukepistrol That's because whenever the tabs are switched the
updateNSView()function is fired it saves the terminal state. ButSwiftTermdoesn't save the state, if you want to I could create an issue and tag the developer.lukepistrol commentedon Mar 7, 2023
@iggy890
SwiftTermis not supposed to save anything. The problem lies in somewhere in our implementation because at some point theSwiftTermview gets deallocated (released from memory) and then reallocated while the saved state is not applied for some reason. Nothing to do withSwiftTerm.bombardier200 commentedon Mar 7, 2023
Yeah I am going to take a look at this and see why the saved state does not get added to the new view, I have done some experimenting and I think I can find a solution.
lukepistrol commentedon Mar 7, 2023
On the latest release (0.0.2-alpha.27) this cannot be reproduced anyway. Can someone please double-check?
Screen.Recording.2023-03-07.at.16.52.28.mov
bombardier200 commentedon Mar 7, 2023
My terminal still does not save
bombardier200 commentedon Mar 7, 2023
@lukepistrol what is your terminal type? maybe a specific type of terminal does not save?
lukepistrol commentedon Mar 7, 2023
@bombardier200 ZSH
iggy890 commentedon Mar 7, 2023
@lukepistrol This issue also happens with me and my terminal type is
ZSHaustincondiff commentedon Jul 4, 2023
@luah5 What do you mean by the tabs are the same?
gdbing commentedon Apr 1, 2024
Seems to me there's two problems.
UtilityAreaTerminalView.swift:247
is reinitializing
terminalsevery time the view loads and should be changed to something likeWith this change, any terminal views you have open will be restored with env variables intact, but, seemingly unrelatedly, the buffer will be reset to a fresh prompt without previous commands and output, like pressing ⌘K. I investigated this for an embarrassingly long time and don't understand why that's happening.