-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ANSI OSC 52 support? #3260
Comments
This would need some thinking around how embedders can conditionally enable it, like how browsers ask if they can access the clipboard. |
Maybe it can be done as plugin so it can be totally disabled, otherwise raising a pop-up window when such a sequence arrives first time in session? |
Just tested this with Firefox and Chrome: setTimeout(() => navigator.clipboard.writeText('Hello there!'), 1000); which seems to work in both as long as something on the page has the focus. Not quite sure about the focus state, it also works if the browser window is in the background, but does not work, if the focus is in the console. What would be possible:
|
I think browsers treat this differently and it may get blocked if it wasn't caused by a "user event" (ie.
The way VS Code copies depends on the environment it's in, so this might need an event. If it was an event the embedder could just not listen to it if it doesn't want to support it then.
We probably wouldn't want to pause the terminal, just request it and not await. |
Isn't it worth to assume that since we are selecting text here in xterm session, we have a focus right now? Focus will be lost in situations like some "mirroring" of terminal output but I don't think this is 1) majority of cases and 2) we should manipulate with clipboard in these situations... |
OSC 52 doesn't mean text is selected. It means the remote process has emitted this sequence. That could happen from a process that's running, such as |
@jaraco Yes, part of the OSC 52 deal is that it works the way around for remote --> local clipboard mapping. For this it cannot be assumed, that the terminal still has focus. A partial workaround could be to implement a deferred clipboard write, which replays the write |
We may want to expose a handler on the API similar to the to |
Is there any update on this? It would be really nice to have this feature in vscode's terminal. |
@YingboMa as with anything where the clipboard is touched we want to make sure there aren't any security concerns (if you log into a malicious server, it could read your clipboard which may have a password in it?), we would need some API to plug the clipboard detection code in anyway I think so that would probably be solved by a warning on the API. Other than that potential issue, it just needs someone to come and help implement it. |
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. This adds a new `registerClipboardService` method to allow headless xtermjs to register their own clipboard service. The browser uses a clipboard service that use the Clipboard API to read/write from and to the clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. This adds a new `registerClipboardService` method to allow headless xtermjs to register their own clipboard service. The browser uses a clipboard service that use the Clipboard API to read/write from and to the clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. This adds a new `registerClipboardService` method to allow headless xtermjs to register their own clipboard service. The browser uses a clipboard service that use the Clipboard API to read/write from and to the clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. This adds a new `registerClipboardService` method to allow headless xtermjs to register their own clipboard service. The browser uses a clipboard service that use the Clipboard API to read/write from and to the clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. This adds a new `registerClipboardService` method to allow headless xtermjs to register their own clipboard service. The browser uses a clipboard service that use the Clipboard API to read/write from and to the clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. This adds a new event listener to the terminal `onClipboard` to allow other external implementations to hook into it. The browser uses a clipboard service that use the Clipboard API to read/write from and to the clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple selections but due to the browser limitations (Clipboard API), this PR only supports manipulating the clipboard selection. This adds a new event listener to the terminal `onClipboard` to allow other external implementations to hook into it. The browser uses a clipboard service that use the Clipboard API to read/write from and to the clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
really looking forward to copy text from tmux inside coder web terminal |
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple clipboard selections but we only support the common ones, system and primary clipboard selections. This adds a new event listener to the common terminal module `onClipboard` to allow external implementations to hook into it. The addon uses the browser Clipboard API to read/write from and to the clipboard. The default `ClipboardProvider` uses the browser Clipboard API. This means it only supports read/write to and from the system clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple clipboard selections but we only support the common ones, system and primary clipboard selections. This adds a new event listener to the common terminal module `onClipboard` to allow external implementations to hook into it. The addon uses the browser Clipboard API to read/write from and to the clipboard. The default `ClipboardProvider` uses the browser Clipboard API. This means it only supports read/write to and from the system clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple clipboard selections but we only support the common ones, system and primary clipboard selections. This adds a new event listener to the common terminal module `onClipboard` to allow external implementations to hook into it. The addon uses the browser Clipboard API to read/write from and to the clipboard. The default `ClipboardProvider` uses the browser Clipboard API. This means it only supports read/write to and from the system clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple clipboard selections but we only support the common ones, system and primary clipboard selections. This adds a new event listener to the common terminal module `onClipboard` to allow external implementations to hook into it. The addon uses the browser Clipboard API to read/write from and to the clipboard. The default `ClipboardProvider` uses the browser Clipboard API. This means it only supports read/write to and from the system clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
Add support to ANSI OSC52 sequence to manipulate selection and clipboard data. The sequence specs supports multiple clipboard selections but we only support the common ones, system and primary clipboard selections. This adds a new event listener to the common terminal module `onClipboard` to allow external implementations to hook into it. The addon uses the browser Clipboard API to read/write from and to the clipboard. The default `ClipboardProvider` uses the browser Clipboard API. This means it only supports read/write to and from the system clipboard. Reference: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands Fixes: xtermjs#3260 Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
…port OSC52 VSCode PR: microsoft/vscode#122083 xterm.js PR: xtermjs/xterm.js#3260
Thank you so much to all the contributors for delivering this feature |
ANSI OSC 52 is a sequence to transport some data from remote console app to client's clipboard. For example, tmux can use it on remote side, and xterm (terminal app), Windows terminal and a number of others -- on client side. It would be very convenient to have such a feature in xterm.js.
Here is a simple test which sends a string from remote to local clipboard (taken here):
printf "\033]52;c;$(printf "%s" "blabla" | base64)\a"
The text was updated successfully, but these errors were encountered: