Home
|
FAQ
|
Feedback
|
Licence
|
Updates
|
Mirrors
|
Keys
|
Links
|
Team
Download:
Stable
·
Snapshot
|
Docs
|
Privacy
|
Changes
|
Wishlist
Some terminal emulators running in a GUI implement an escape sequence that an application can use to provide data to write to the main GUI's clipboard. So, for example, it might be possible to copy to the clipboard inside an editor inside your terminal, using the editor's UI action for that purpose rather than the terminal's, and then paste into some other GUI application not contained in the same terminal.
The sequence is in the OSC family, namely OSC 52. An example I saw in the terminal output of an application went ESC ] 52 ; c ; ZXhhbXBsZSB0ZXh0 BEL, where ESC and BEL represent ASCII control characters; spaces are inserted for clarity and are not part of the real escape sequence; and the italic text in the middle is the base64 encoding of the data intended to be written to the clipboard. (In this example, that base64 text decodes to the string "example text".)
(At least, I assume some terminal emulators support this sequence. I've at least observed an application sending it, though I don't know of a specific terminal that honours it. I also haven't seen a specification, so I don't know what the ;c; in the middle of that sequence is for, and what different things might be expected to happen if you replaced it with something else.)
Similarly to osc8, I don't think it's a good idea to let terminals write to the system clipboard under application control. There are too many ways that could be abused. Since I haven't yet found a terminal that does honour this sequence, it appears that other implementors feel similarly!
However, also similarly to osc8, I'm considering the possibility that it might at least be useful if PuTTY recognised the OSC 52 sequence, captured the paste data, and allowed a user to retrieve it. If an application uses this mechanism to send data that the user actually needs, it's one thing to prevent it from being written straight to the clipboard, but another to drop it on the floor completely so that the user can't even find out what it was.
That basic requirement isn't a specification, though. There are quite a lot of user interface issues to be decided on. And since many other terminals also seem not to implement this sequence, it might be that applications will continue not to depend on it working.