Xterm.js: Option for configurable tab width?

Created on 18 Jan 2017  路  10Comments  路  Source: xtermjs/xterm.js

xterm.js inherits from term.js the default tab width of 8 characters:

for (; i < this.cols; i += 8) {
  this.tabs[i] = true;
}

I think it would be very useful, especially for space-constrained web applications, to be able to set this width to a lower setting.

typenhancement

Most helpful comment

It's certainly possible to change tabwidth from within a normal TTY: https://linux.die.net/man/1/tabs

This is more difficult on the web unless you want to have terminals secretly run the specific commands emitted by a program like tabs. I think saner is to configure default tab stop width.

Any program that does any kind of tricky spaced display almost certainly does not depend on hard tabs.

I think a feature as simple as options.initialTabStopWidth defaulting to 8 would work nicely.

All 10 comments

This seems like something that we probably need to align with xterm, and there doesn't seem to be a nice way to configure it for that from a cursory search.

Is this project meant to be a strict interpretation of real xterm? I really did not get that vibe from the way you self-describe in the README and that other issue I opened.

Not super strict, my main concern is applications relying on 8 being hard coded.

I agree with @Tyriar, especially because the tab has a stricter meaning in terminals.

Could this mess up with programs emitting "tabular" output?

Also does any terminal application provide this kind of customization? Terminal.app in macOS does not.

Disclaimer: I'm by no means an authority on the matter, I'm not sure if anything I use even uses tab stops :smile:

It's certainly possible to change tabwidth from within a normal TTY: https://linux.die.net/man/1/tabs

This is more difficult on the web unless you want to have terminals secretly run the specific commands emitted by a program like tabs. I think saner is to configure default tab stop width.

Any program that does any kind of tricky spaced display almost certainly does not depend on hard tabs.

I think a feature as simple as options.initialTabStopWidth defaulting to 8 would work nicely.

I think you've convinced me :smiley:

Yep me too. I have to admit that I was not aware of tabs or how programs display tabular UIs in the terminal.

I think that a tabStopWidth (no need for initial I think?) option, defaulting to 8, would be 馃憤 . What do you think @vincentwoo?

I am fine with whatever nomenclature you deem appropriate!

@vincentwoo please take a look at #497 and put your comments there about the implementation.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

albinekb picture albinekb  路  4Comments

jerch picture jerch  路  3Comments

zhangjie2012 picture zhangjie2012  路  3Comments

travisobregon picture travisobregon  路  3Comments

Tyriar picture Tyriar  路  4Comments