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

cating a file replaces tabs with spaces #1829

Closed
prometheanfire opened this issue Jul 22, 2019 · 7 comments
Closed

cating a file replaces tabs with spaces #1829

prometheanfire opened this issue Jul 22, 2019 · 7 comments

Comments

@prometheanfire
Copy link

I have a file with the following contents.

https://gist.github.com/6fdaabc951772aef98a7d91b18298b16

When cating the file in kitty I get spaces where tabs should be. When doing the same with xfce4-terminal I get the tabs as expected.

Using git master as of (10:41:06 PM 07/21/2019, US/Central)

@kovidgoyal
Copy link
Owner

There is no such thing as a tab character in a terminal. A tab is an
instruction to move the cursor to the next tab stop. So when you copy
text from a terminal screen you will get spaces unless the terminal goes
out of its way to convert the blank cells back into tabs. kitty does not do
this, since I have never felt the need for it, but patches are welcome.

See the screen_tab() function in screen.c for how it is implemented. And
see the unicode_for_range() function for how selected text is copied. So
if you want to implement this the best way is probably to store an extra
attribute on the GPUCell->attrs in screen_tab() and add support for it
in unicode_for_range(). But note that this is not totally trivial to
implement, the locations of tabstops in a terminal can be changed
dynamically so unicode_for_range will have to be made aware of them
and all the places that delete/modify attributes will need to have
code added to make them aware of the new attribute.

@prometheanfire
Copy link
Author

it makes copying patches to others a real pain :(

not sure how xfce4-terminal does it

@kovidgoyal
Copy link
Owner

Why do you cat a patch to copy it?

@prometheanfire
Copy link
Author

wgetpaste wasn't working right at the time (since fixed). Doesn't look like alacritty supports the tab output either so I'll live with it :D

@kovidgoyal
Copy link
Owner

You want to copy a text file to the clipboard, the canonical way to do it in kitty is with the clipboard kitten

kitty +kitten clipboard --help

This way you dont need to rely on possibly buggy third party tools. Note that for it to work clipboard_control must be enabled in kitty.conf (which is the default).

@prometheanfire
Copy link
Author

thanks for the tip, I'll look at tying it into the my sway config (using wl-copy now).

@prometheanfire
Copy link
Author

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

2 participants