-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Implement configurable tab stop width #497
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
Conversation
|
What does |
|
I added it into |
a56e992 to
8cb46f2
Compare
|
@Tyriar I rebased with master and resolved conflicts. This is ready for review. |
Tyriar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no easy way to re-render already printed tab stops. In order to achieve this we will have to separate the data from the presentation layer and re-render the whole thing, which is a big issue.
Do we need to worry about this and/or file a follow up?
demo/index.html
Outdated
| <h2>Options</h2> | ||
| <p> | ||
| <label><input type="checkbox" id="option-cursor-blink"> cursorBlink</label> | ||
| <label>cursorBlink <input type="checkbox" id="option-cursor-blink"></label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally checkboxes are at the start of the line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this to keep uniformity with the rest. Will revert.
demo/index.html
Outdated
| <label>scrollback <input type="number" id="option-scrollback" value="1000" /></label> | ||
| </p> | ||
| <p> | ||
| <label>tabStopWidth <input type="number" id="option-tabstopwidth" value="4" /></label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value=8 as the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, forgot it from testing.
demo/main.js
Outdated
| term.setOption('scrollback', parseInt(optionElements.scrollback.value, 10)); | ||
| }); | ||
| optionElements.tabstopwidth.addEventListener('change', function () { | ||
| term.setOption('tabStopWidth', parseInt(optionElements.tabstopwidth.value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add radix of 10 as second arg as it's a mandatory arg https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
demo/main.js
Outdated
| cursorBlink: optionElements.cursorBlink.checked, | ||
| scrollback: parseInt(optionElements.scrollback.value, 10) | ||
| scrollback: parseInt(optionElements.scrollback.value, 10), | ||
| tabStopWidth: parseInt(optionElements.tabstopwidth.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Radix arg
| this.element.classList.toggle(`xterm-cursor-style-underline`, value === 'underline'); | ||
| this.element.classList.toggle(`xterm-cursor-style-bar`, value === 'bar'); | ||
| break; | ||
| case 'tabStopWidth': this.setupStops(); break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually we could move this to event listeners which would probably be a better structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. It does the job for now, so let's keep this for another PR.
|
Changing tab will likely break |
|
Looking at the tab stuff for #259, I don't think re-rendering would actually be desirable. There is the issue of how programs get the tab size though. |
|
I also fixed comments in demo, so @Tyriar feel free to take another look. |
|
It was certainly tabs on my Macbook, I'll grab your branch and verify. |
|
This also happens on Terminal.app, maybe this is just a price you pay? |
|
You can fix this on linux by doing something like: I guess that's just how it is 😄 |
|
Well, while this view sucks, technically there is nothing wrong about it. Take a close look and you will see that each file name is being printed at the first available tab stop. The tab stop width though is not available somehow to My opinion is that this is the price you have to pay eventually for such a feature and that you should be careful with using it. I guess it has it's use cases though. |
|
Yeah, this is the behavior of other terminal emulators that set via calling |
|
Sorry was late to the party. I agree that tab stop width changes should not rerender previous content. Otherwise, I have no comments! |


This PR introduces configurable tab stop width.
Current issues
term.setupStops()after setting the option, without a hack into the private API. A private_optionChangedevent could definitely solve this. Ideas @Tyriar?Documentation PR: xtermjs/xtermjs.org#13
Closes #488.