This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
We don't let the tab size be 0, but if we just return 0 when it is 0, then this code won't break if we ever let it be 0. We know that the column will always be zero if the tabsize is 0.
Does CM, lets you use 0, for tabsize? If so, maybe we can fix other issues like this and make the min be 0.
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.
I fixed the code so that if anyone did set
tabSizeto 0, then we wouldn't retrieve pref on every Tab char.I can't think of any reason why you'd want
tabSizeto be 0. Someone recently did something similar (#7020) but it was a hack that should have been done differently. Until I hear of a valid reason for doing it, then I think the minimumtabSizeshould be 1.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.
It would be just for consistency. After the validation code is merged, we could assume that the tab size will be always be a value between 1 and 10. But here you assume that it can be 0, but if it is 0, then
(column % tabSize) = NaN, and the code will return NaN, which isn't what you expect. Maybe we can just addif (tabSize = 0) { return 0; }?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.
Good catch. I didn't notice that. Fixed.