Skip to content
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

Support OSC52 #247

Closed
tdupes opened this issue Jun 14, 2021 · 14 comments
Closed

Support OSC52 #247

tdupes opened this issue Jun 14, 2021 · 14 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@tdupes
Copy link

tdupes commented Jun 14, 2021

This would provide a way to copy text to the system clipboard even if you are using it through SSH without X forwarding. It's also a much cleaner design of delegating clipboard management to the emulator itself instead of helix having to handle different environments: X, Wayland, etc.

A solution to this potentially obsoletes #76

@pickfire
Copy link
Contributor

Crossterm doesn't seemed to support that. Can you open this in upstream crates like https://github.com/crossterm-rs/crossterm and https://github.com/redox-os/termion which we might switch to later?

@archseer
Copy link
Member

OSC52 doesn't fully solve #76 because it only does yanking, not pasting. Would be good to have support for though.

@CBenoit CBenoit added the C-enhancement Category: Improvements label Jun 18, 2021
@kirawi
Copy link
Member

kirawi commented Jun 18, 2021

Crossterm doesn't seemed to support that. Can you open this in upstream crates like https://github.com/crossterm-rs/crossterm and https://github.com/redox-os/termion which we might switch to later?

Termion isn't cross-platform, so I don't think we should switch to that.

@tdupes
Copy link
Author

tdupes commented Jun 18, 2021

@archseer, I was taking the title of #76 too literally ("Yank to the clipboard").

@pickfire Is it necessary to rely on the crossterm for that? as far as I can tell it can implemented with a simple print statement. Unless I am missing something with how that would interfere/not be compatiable with crossterm

    print!("\x1B]52;c;{}\x07", base64::encode(&text_to_copy));

@pickfire
Copy link
Contributor

pickfire commented Jun 19, 2021

@pickfire Is it necessary to rely on the crossterm for that? as far as I can tell it can implemented with a simple print statement. Unless I am missing something with how that would interfere/not be compatiable with crossterm

We could do that but then we need to add a layer on top of crossterm for or otherwise it breaks cross-platform compatibility, or maybe we just put compile time os flag, but it would be best if we can rely on crossterm or termwiz so only terminal that accept it gets it. Need to see what @archseer think.

@sudormrfbin
Copy link
Member

FWIW #310 will land soon (it doesn't solve the SSH issue though).

@tdupes
Copy link
Author

tdupes commented Jun 29, 2021

Have a solution hidden behind a feature flag on my fork at tdupes@f5cc704. Although it might make more sense to be a backup if the paste doesn't succeed as opposed to doing both the print and the paste

@kirawi kirawi added the A-helix-term Area: Helix term improvements label Oct 12, 2021
@theowenyoung
Copy link

theowenyoung commented Jul 6, 2022

Are there any updates about this?

@tdupes
Copy link
Author

tdupes commented Jul 6, 2022

@theowenyoung Helix still does not support it directly but helix does support tmux as a clipboard provider and tmux has osc52 support so an osc52 sequence should be emitted when you copy if you are running helix in a tmux session.

@theowenyoung
Copy link

@tdupes Thanks! I tried on the remote server with tmux, but it seems still can not yank to the local system clipboard, do I need to do some config? remote tmux copy mode can copy to my local machine.

@tdupes
Copy link
Author

tdupes commented Jul 8, 2022 via email

@theowenyoung
Copy link

It seems that there aren't debug messages there. So I checked the conditions in my remote machine, I think it should go to the tmux branch, but nothing happened. I can be sure the TMUX-related variable is settled correctly. By the way, did you try it on a remote server with tmux? does it work fine?
.

 echo $TMUX && which tmux
/tmp/tmux-1000/default,55799,0
/usr/bin/tmux

@groves
Copy link
Contributor

groves commented Jul 27, 2022

Had a crack at this in #3220

@the-mikedavis
Copy link
Member

Closed by #3220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

9 participants