Copy explicit \t
(tab) with tab, not spaces
#3486
Replies: 5 comments 8 replies
-
Yes this is expected behavior. It's not actually 4 spaces, it's simply aligning to the next tabstop. Perhaps it would be a good quality of life feature to encode the tabs as state in a way that lets the user copy them as tabs instead of spaces though. |
Beta Was this translation helpful? Give feedback.
-
Interesting. Converting to a feature request discussion and renaming. I'd be curious next what other terminals do here. I'm willing to do something different, just curious! |
Beta Was this translation helpful? Give feedback.
-
I've updated .editorconfig file to set indent_style to tab like this: indent_style = tab and this helped, not sure if it's your case. |
Beta Was this translation helpful? Give feedback.
-
Okay, further question since other TEs do this. If I do the following sequence, what happens:
Does writing the one "space" turn the entire tab into spaces? Since tabs are translated into spaces for a terminal, I'm just curious how these sorts of edge cases are handled. I'll write a shell script at some point to research this further. |
Beta Was this translation helpful? Give feedback.
-
I regularly copy TSV file output from the terminal and I paste it into Google Sheets or LibreOffice Calc. In Kitty, GNOME Terminal, and others, the tab characters are preserved, and the cells get slotted into the spreadsheet correctly. It's a nice feature in the spirit of Ghostty's goals of integrating well with the rest of the desktop environment. Sadly, I can't get this nice intergation with Ghostty, since Ghostty replaces tab characters with space characters. Google Sheets and LibreOffice Calc (rightly) don't try to handle spaces as cell separators, but they do know how to interpret tab characters. Expected output (incudes a tab character):
Incorrect output from Ghostty (replaces a tab character with spaces):
If you're viewing this discussion in your browser, you can see the difference by highlighting the example output with your mouse. With spaces characters, you can highlight each space individually, whereas, with the tab character, you can only highlight the whole tab character. |
Beta Was this translation helpful? Give feedback.
-
I am running Ghostty 1.0 on a mac. My shell is zsh. I was able to reproduce the issue in bash as well. The default Terminal.app works good.
https://github.com/user-attachments/assets/cc5deea1-fce1-4bad-a800-e4c92f339d81
➜ ~ echo -e 'test\u9test' test test
Is this behaivour expected?
Beta Was this translation helpful? Give feedback.
All reactions