feat: Set onbeforeunload to avoid losing the current terminal session with Ctrl+W#23
Conversation
`./validate.sh` currently fails on a fresh gitpod workspace with: ``` rm: cannot remove '/ide/xterm': Is a directory ln: failed to create symbolic link '/ide/xterm/xterm': File exists ```
|
Thanks for the efforts @erikmd! We'll take a look at this 👋 |
|
@filiptronicek could you take a look? 🙏 |
|
Hey there @erikmd 👋, I took the liberty to push to your PR to make this configurable on the user level with the Below is a demo (left is with |
|
OK @filiptronicek, thanks a lot! 👍 Side-question: will xterm-web-ide be reused in Gitpod Flex at some point? or it is strongly related to Gitpod Classic. |
|
@erikmd because of the architectural differences between Classic and Flex, the editor will definitely not be able to be used as-is. That said, because of just how Flex-ible Flex is designed to be, there definitely will be (and to some degree already are) extension points for a slightly modified Xterm IDE. AFAIK, you can actually use Automations today to run the IDE for every environment you create (see the |
|
OK, thanks @filiptronicek for your feedback! |

Description
As an Emacs user (and co-maintainer of several packages), I extensively use Gitpod Terminal Browser in multiple occasions. Gitpod Terminal is a very nice tool!
— even if the README states that "it is not ready for production use", I guess it's pretty close 👍
Motivation of this PR: given the Ctrl+W is a very typical Emacs shortcut that must be avoided when using Gitpod (because it amounts to stopping the workspace and losing the ambient session), this small feature appears to be very important for Gitpod+Terminal users.
BTW I followed advice from https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event:
Then tested the feature successfully on Firefox ESR (under Debian Stable).
Cc @filiptronicek @mustard-mh @loujaybee @axonasif WDYT?
Related Issue(s)
Fixes #gitpod-io/gitpod#18416
How to test
https://gitpod.io/new/?autostart=false&useLatest=true&editor=xterm#https://github.com/gitpod-io/xterm-web-ide/pull/23
./validate.sh(after applying fix: validate.sh was incomplete for testing #23 #24)https://debug-…gitpod instance (and click Dismiss on the dialog)window.onbeforeunloadis notnullDocumentation
/hold