Skip to content

🐞 Terminal State is not saved when switching tabs #923

Description

@bombardier200

Description

When you switch tabs on status bar, and then go back to the terminal, it will be refreshed.

To Reproduce

  1. Expand the status bar to see the terminal.
  2. Enter a command in the terminal
  3. Select a different tab in the status bar
  4. Select the terminal tab

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

Activity

  1. moved this from 🆕 New to 📋 Todo in CodeEdit Projecton Feb 16, 2023
  2. austincondiff commented on Feb 16, 2023

    @austincondiff
    Collaborator

    Might be related to #917 and @Code-DJ's PR #984

  3. iggy890 commented on Mar 7, 2023

    @iggy890
    Contributor

    I've looked into this and it seems that it's a SwiftTerm bug.

  4. lukepistrol commented on Mar 7, 2023

    @lukepistrol
    Member

    @iggy890 what exactly brings you to this conclusion?

  5. iggy890 commented on Mar 7, 2023

    @iggy890
    Contributor

    @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.

  6. lukepistrol commented on Mar 7, 2023

    @lukepistrol
    Member

    @iggy890 SwiftTerm 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.

  7. bombardier200 commented on Mar 7, 2023

    @bombardier200
    ContributorAuthor

    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.

  8. lukepistrol commented on Mar 7, 2023

    @lukepistrol
    Member

    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
  9. bombardier200 commented on Mar 7, 2023

    @bombardier200
    ContributorAuthor

    My terminal still does not save

  10. bombardier200 commented on Mar 7, 2023

    @bombardier200
    ContributorAuthor

    @lukepistrol what is your terminal type? maybe a specific type of terminal does not save?

  11. lukepistrol commented on Mar 7, 2023

    @lukepistrol
    Member
  12. iggy890 commented on Mar 7, 2023

    @iggy890
    Contributor

    @lukepistrol This issue also happens with me and my terminal type is ZSH

  13. austincondiff commented on Jul 4, 2023

    @austincondiff
    Collaborator

    @luah5 What do you mean by the tabs are the same?

  14. gdbing commented on Apr 1, 2024

    @gdbing

    Seems to me there's two problems.

    UtilityAreaTerminalView.swift:247

    .onAppear(perform: initializeTerminals)
    

    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.

  15. moved this from 📋 Todo to 🏁 Complete in CodeEdit Projecton Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions