Fixing webshell multiline paste issue #313
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So it seems the multiline paste issue (#311) was caused by how we multiplexed the WebSocket connections.
Since the WebShell is multiplexed over all the WebSocket connections, we can't have the terminal (
xterm.js
) reset the shell when it connects to the shell. This could cause someone in another instance of the terminal to lose state.But that does mean that sometimes (likely a
jline
bug),jline
doesn't send a newly connected terminal the fact that xterm's bracketed paste mode is enabled. This usually happens when the shell is reset (like when a newline or clear commands are given). When this happensxterm.js
thinks that bracketed paste mode is disabled and trying to send the entire string as is without the bracketed paste mode delimiters.To fix this, we manually send the code for enabling bracketed paste mode when a new WebSocket connects. Since enabling the mode is idempotent this doesn't affect the other terminals.