Repository navigation
🐞 Terminal State is not saved when switching tabs #923
Description
Activity
I've looked into this and it seems that it's a SwiftTerm bug.
@iggy890 what exactly brings you to this conclusion?
@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.@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.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.
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
My terminal still does not save
@lukepistrol what is your terminal type? maybe a specific type of terminal does not save?
@bombardier200 ZSH
@lukepistrol This issue also happens with me and my terminal type is
ZSH@luah5 What do you mean by the tabs are the same?
Seems to me there's two problems.
UtilityAreaTerminalView.swift:247
.onAppear(perform: initializeTerminals)is reinitializing
terminalsevery 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields🏁 Complete
Description
When you switch tabs on status bar, and then go back to the terminal, it will be refreshed.
To Reproduce
Expected behavior
The terminal should keep its state and should not be a fresh screen when you select the tab again.
Version information
CodeEdit: 0.0.1 build 7
macOS: 13.1
Additional context
Screen.Recording.2023-01-11.at.12.13.43.AM.mov