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 OCS52 #423

Open
Kapsonfire-DE opened this issue Oct 18, 2022 · 5 comments
Open

Support OCS52 #423

Kapsonfire-DE opened this issue Oct 18, 2022 · 5 comments

Comments

@Kapsonfire-DE
Copy link

I'd really like to see support of OCS52 allowing shcopy to work
https://github.com/aymanbagabas/shcopy

@cyd01
Copy link
Owner

cyd01 commented Nov 18, 2022

Do you try the feature send standard output to clipboard ?

@mgrant0
Copy link

mgrant0 commented Jun 8, 2023

I have tried. I sort of got it to work using tmux.

  1. an executable script in a file named wcl:
# start send to ansi printer
echo -ne '\e[5i' >$SSH_TTY

# send stdin to the outer terminal
cat >$SSH_TTY

# end ansi printer output
echo -ne '\e[4i' >$SSH_TTY
  1. add this to your .tmux.conf file:
bind -Tcopy-mode MouseDragEnd1Pane send -X copy-pipe-and-cancel '~/bin/wcl'
  1. set the ANSI printer output to go to the clipboard in KiTTY.

And then yes, you can select stuff on the screen and it goes to the Windows clipboard.

But it doesn't deal well with unicode.

If I use your bash function at the unix/linux bash shell without tmux, as in just log into a remote machine with KiTTY and type at the shell:

% function wcl {
  echo -ne '\e''[5i'
  cat $*
  echo -ne '\e''[4i'
  echo "Copied to Windows clipboard" 1>&2
}
% echo £500 | wcl
Copied to Windows clipboard

This is what I get when I paste into notepad:

£500

€100 pastes as €100

I tried piping the cat to iconv to convert it to something else like utf-16 but it's even worse. I tried several (definitely not all!) different encodings in iconv but I couldn't find one which was clean. Any idea if this is an encoding issue?

@mgrant0
Copy link

mgrant0 commented Jun 8, 2023

I opened an issue for this: #494

@mgrant0
Copy link

mgrant0 commented Jun 8, 2023

In regards to OSC-52 support (note the mis-spelling in the title!), yes I would also like to see that in KiTTY!

In another test I did, I managed to create a terminfo override which shoved the ESC [5i some-text ESC [4i into the terminal output but then, I get base64 encoded text in the Windows clipboard. This base64 text is what OSC-52 is doing.

It would be great if KiTTY had direct OSC-52 support. That would make getting text from tmux to Windows easier. To be clear why OSC-52 is important here is tmux has an internal copy buffer that is not connected to KiTTY's scrollback buffer. One might scroll up in tmux, copy several screenfulls to the copy-buffer and want to paste them somewhere. In KiTTY, you could try to do this manually using the scrollback buffer but this doesn't always work when sitting in pane in tmux which for me completely messes up the scrollback in KiTTY.

I'm unclear on how the reverse would be done: getting something from Windows clipboard into tmux's copy-buffer. This is a step beyond right-click pasting in KiTTY.

@mgrant0
Copy link

mgrant0 commented Jun 14, 2023

This issue should probably be closed. OSC52 now supported in KiTTY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants