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

OSC 52 truncates input at first NUL byte #5483

Closed
mspielberg opened this issue Sep 6, 2022 · 1 comment
Closed

OSC 52 truncates input at first NUL byte #5483

mspielberg opened this issue Sep 6, 2022 · 1 comment
Labels

Comments

@mspielberg
Copy link

Describe the bug
OSC 52 truncates input at first NUL byte. This affects the clipboard kitten as well since under the covers it uses OSC 52.

To Reproduce
Steps to reproduce the behavior:
On OSX:

$ echo -e 'hello\0world' | pbcopy ; pbpaste |hexdump -C ; \
echo -e 'hello\0world' | kitty +kitten clipboard ; pbpaste | hexdump -C ; \
printf "\e]52;c;%s\x07" $(echo -e 'hello\0world' | base64) ; pbpaste | hexdump -C

Observe that the output of the pbcopy/pbpaste combination preserves the entire input, but traveling through Kitty does not.

Environment details

kitty 0.26.2 created by Kovid Goyal
Darwin mbp-010666 20.6.0 Darwin Kernel Version 20.6.0: Tue Feb 22 21:10:41 PST 2022; root:xnu-7195.141.26~1/RELEASE_X86_64 x86_64
ProductName:	macOS ProductVersion:	11.6.5 BuildVersion:	20G527
Frozen: True
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /bin/zsh
Loaded config files:
  /Users/mspielberg/.config/kitty/kitty.conf

Config options different from defaults:
font_family             Cascadia Code PL
font_size               16.0
tab_bar_style           slant
Colors:
	active_tab_background   #65435e   
	active_tab_foreground   #b4bdc3   
	background              #1c1917   
	color0                  #1c1917   
	color1                  #de6e7c   
	color10                 #8bae68   
	color11                 #d68c67   
	color12                 #61abda   
	color13                 #cf86c1   
	color14                 #65b8c1   
	color15                 #888f94   
	color2                  #819b69   
	color3                  #b77e64   
	color4                  #6099c0   
	color5                  #b279a7   
	color6                  #66a5ad   
	color7                  #b4bdc3   
	color8                  #403833   
	color9                  #e8838f   
	cursor                  #c4cacf   
	cursor_text_color       #1c1917   
	foreground              #b4bdc3   
	inactive_tab_background #352f2d   
	inactive_tab_foreground #b4bdc3   
	selection_background    #3d4042   
	selection_foreground    #b4bdc3   

Important environment variables seen by the kitty process:
	PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
	LANG                                en_US.UTF-8
	SHELL                               /bin/zsh
	USER                                mspielberg
@mspielberg mspielberg added the bug label Sep 6, 2022
@kovidgoyal
Copy link
Owner

This is a limitation of GLFW. It's API takes only NUL terminated strings
when setting the clipboard (glfwSetClipboardString()). In any case, NUL
bytes aren't really valid for text data, which is what is being set
here. If you are using them as a separator use the ASCII file and record
separator bytes instead.

If you really want to support NUL bytes, then a PR is welcome, but its
not worth the effort to me.

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

No branches or pull requests

2 participants