-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Allow any indent size from 1 to 16 #7429
Conversation
Previously, helix only allowed indent sizes from 1-8, but this isn't anything fundamental. This commit changes to allow any indent sizes that fit within a u8. This commit is motivated by a hackernews user who has a deranged desire to have a 12 space indent. See request here: https://news.ycombinator.com/item?id=36429221 Code motivated by suggestions here: https://news.ycombinator.com/item?id=36432996
#7178 the limit is 16, so the static string should be limited to that. |
That's tab width and not indent width. That said I still think that a value of 16 is large enough. |
Unfortunately, my first PR was too deranged for the maintainers of helix. :( I have restricted the indents to be only 1-16.
Now clamping both in `IndentStyle`'s `to_str` and `from_str` methods. Also added a constant to be clearer where the random 17's and 16's are throughout the file.
Okay, all suggestions fixed and clippy should be happy. I also added a constant so it's clear why the literals were chosen, but I can put it back to literals if it's preferred. Also, I didn't see a good way to test the failing case where indent > 16 specifically because behavior could vary between debug and release builds (debug will panic for indent > 16 while release will pass with indent = 16) |
Previously, helix only allowed indent sizes up to 8. This commit changes to allow any indent sizes that fit within a u8.
This pr is motivated by a hackernews user with a
derangednormal desire to have a 12 space indent.See request here: https://news.ycombinator.com/item?id=36429221
Code motivated by suggestions here: https://news.ycombinator.com/item?id=36432996
I used a single line of 256 spaces because it's super simple and easy to validate rather than using an additional dependency like const_format or writing a macro myself.