-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Theme is lost when running .open() multiple times #1323
Comments
Hmm, I guess I put that there to prevent |
@Tyriar I would consider calling On https://dashboard.resin.io/ we use xterm.js 2.7.x for our webterminal. On the dashboard you are able to open a webterminal session, navigate away to another page (removing the DOM element) and then come back to the webterminal page (adding a new DOM element) and resume your session where you left off. This functionality still works using xterm 3.2.0, you just need to set the theme again after calling The ability to 'unattach' the xterm instance from the DOM and then 're-attach' it at a later date is a really powerful tool. I understand that it's not a common use case though. |
@LucianBuzzo well VS Code and Hyper both do this so I think we should support it. I guess we'll just support fixing everything up when open is called a second time (as opposed to adding a |
@Tyriar So AFAIK the only thing that you need to do is set the theme option again. Can you expand a little bit on why the theme is set to |
@LucianBuzzo I did that because the theme option is passed onto ColorManager and then that is the source of truth. Colors can be invalidated which could lead to confusion (eg. setting a color to "redd" will use the default color as "redd" isn't valid). This is what VS Code does atm, I haven't actually seen a problem with the theme because I only ever call Perhaps this should be the recommended way as it's fairly simple? |
Maybe we should also offer a |
This looks like it was fixed on issue #2174 commit: 322ae13 but now it's back in |
This should get fixed in #2435 |
If you call
.open()
a second time, the terminal will lose its theme. This is due to the theme option being set to null here https://github.com/xtermjs/xterm.js/blob/3.2.0/src/Terminal.ts#L700You can get around this by setting the theme option again, but its not very intuitive.
Details
Steps to reproduce
The text was updated successfully, but these errors were encountered: