xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
17.44k stars 1.62k forks source link

Handle OSC 52 for clipboard manipulation #4863

Closed aljazerzen closed 10 months ago

aljazerzen commented 10 months ago

Initial implementation of #3260

This is a proof of concept, but I would be happy to get feedback. Mainly to these questions:

jerch commented 10 months ago

where should this code reside in? A separate service? It needs access to the output stream of the shell process if we want to implement pasting correctly.

Prolly an addon would be the easiest way currently. Note that there is already PR #4220 for OSC52. Plz check that out, maybe a combined effort is better here.

what's the policy here on async functions?

The terminal core is completely free of async functions, mainly for speed reasons. Thats especially true for the vt parser. The parser still supports async handlers, plz see https://xtermjs.org/docs/guides/hooks/#async-actions-in-parser-hooks for details and its drawbacks. I'd say the general stance here is - avoid async a long as possible, unless a sync variant is totally unreasonable.

are there any utilities for dealing with arbitrary base64 encoded data?

For synchronous high performance base64 decoder/encoder maybe have a look at https://github.com/jerch/xterm-wasm-parts.

Tyriar commented 10 months ago

Thanks for the PR! This has already had a lot of effort put into it in https://github.com/xtermjs/xterm.js/pull/4220 and is quite close to getting merged at this point.