-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(selection-indices): zero pad according to max number of digits. #13386
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
base: master
Are you sure you want to change the base?
Conversation
@@ -55,6 +55,7 @@ | |||
| `insert-final-newline` | Whether to automatically insert a trailing line-ending on write if missing | `true` | | |||
| `trim-final-newlines` | Whether to automatically remove line-endings after the final one on write | `false` | | |||
| `trim-trailing-whitespace` | Whether to automatically remove whitespace preceding line endings on write | `false` | | |||
| `padding_selection_index_register` | Whether to align selection indices register with zero padding | `false` | |
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.
pad-selection-index-register
would probably be a better name for this option
let mut number_of_digits = 0 as usize; | ||
if editor.config().padding_selection_index_register { | ||
number_of_digits = (selections.ilog10() + 1) as usize; | ||
} |
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.
let mut number_of_digits = 0 as usize; | |
if editor.config().padding_selection_index_register { | |
number_of_digits = (selections.ilog10() + 1) as usize; | |
} | |
let number_of_digits = if editor.config().padding_selection_index_register { | |
selections.ilog10() as usize + 1 | |
} else { 0 } |
I'm not sure if this deserves a config option. Something like #13354 with a flag such as |
Implement #13356
First oss contribution, let me know if something is wrong.