Scott Percival created GUACAMOLE-1973:
-----------------------------------------

             Summary: Add XTerm bracketed paste support to terminal emulator
                 Key: GUACAMOLE-1973
                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-1973
             Project: Guacamole
          Issue Type: Improvement
          Components: guacamole-server, Terminal
            Reporter: Scott Percival


The clipboard feature in the terminal emulator sends the clipboard buffer 
directly to the server, without any preprocessing. Current best practice for 
terminal emulators appears to be to strip out the majority of control 
characters, and for shells that support the feature, inject escape sequences at 
the start and end of the data to indicate pasted input is incoming (aka. XTerm 
bracketed paste mode - https://invisible-island.net/xterm/xterm-paste64.html ). 

Newer versions of shells with bracketed paste support will buffer multi-line 
inputs on screen for review, rather than immediately executing them. In 
addition this provides a better experience in programs which treat pasted data 
differently from typed data, e.g. IPython will perform automatic indentation on 
typed text but not pasted text.

The approach I took is based on this patch adding filtering and bracketed paste 
to Microsoft Terminal - https://github.com/microsoft/terminal/pull/9034/files . 
The difference is that Microsoft Terminal uses wchar internally, making it 
easier to separate out lone Unicode C1 control characters (0x80-0x9f) without 
impacting UTF-8 codepoint continuation. I ended up writing a sieve to pass 
valid UTF-8 codepoints.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to