Xterm.js: Support rendering of tab characters in terminal

Created on 27 Jun 2017  路  6Comments  路  Source: xtermjs/xterm.js

Downstream: https://github.com/Microsoft/vscode/issues/29523

node -e "console.log('a\tb')" should output an actual tab. This means it's considered a single character by the selection logic and that it's copied as a \t char not several spaces. This probably won't be too difficult to deal with by leveraging and improving upon the double width char code.

This is supported by gnome-terminal, Terminal.app and iTerm2.

help wanted typenhancement

Most helpful comment

@Tyriar It depends on what perspective you come from. At least for me I expect tabs to be copied when that was what I pushed to the console. I often do this when I want to generate tab delimited data using powershell. As it is now I use regex to replace spaces with tabs which is just another step.

I can understand where you are coming from in how consoles used to function. I can also understand how many other things you all have to work on. I appreciate all the good work!

All 6 comments

It's pretty hackish in gnome-terminal (and reportedly in iterm2 too).

The thing is, TAB is a control character that's supposed to move the cursor, but preserve the characters (including their attributes such as background color) it jumps through. So you can only do this smart copy-pasteable TAB thingy if it's printed after the current end of the line (which is good enough in practice for most cases).

You might find this (and stuff linked from there) useful: https://gitlab.com/gnachman/iterm2/issues/6193.

Closing as designed as per above comment. I don't really want to do the copy \t chars anymore as it's a bit of a hack anyway.

What is the resolution on this? There was a downstream issue related to this that was also closed. I am interested in this functionality as I imagine others are as well.

@hansvonn it didn't really seem like it made sense to do given how \t works behind the scenes.

@Tyriar It depends on what perspective you come from. At least for me I expect tabs to be copied when that was what I pushed to the console. I often do this when I want to generate tab delimited data using powershell. As it is now I use regex to replace spaces with tabs which is just another step.

I can understand where you are coming from in how consoles used to function. I can also understand how many other things you all have to work on. I appreciate all the good work!

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pfitzseb picture pfitzseb  路  3Comments

circuitry2 picture circuitry2  路  4Comments

johnpoth picture johnpoth  路  3Comments

albinekb picture albinekb  路  4Comments

Tyriar picture Tyriar  路  4Comments