Fix: [line-number-mode] - Wrapped line attributes & Uniform number width #1732
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.
This change is fixes 2 bugs with line-numbers-mode. They are broken up into 2 commits if you wish to view the changes individually. Line numbers are looking a lot smoother now.
Wrapped lines have no font attributes
Currently, wrapped lines do not have the same font attributes as the line numbers and it looks very strange.
I moved the computation of the wrapped left area to a generic and removed the implementation(not needed when no line numbers). line-numbers-mode then implements this generic to allow using it's attributes to highlight the blank spaces.
I could have just exposed the attribute, but this is now matching with the unwrapped lines, and it allows more flexibility in extensions(adding icons to wrapped lines, etc.)
Before:
After:
Line numbers format match max buffer lines
This is a fix for my own issue: improve: [line-numbers-mode] - Sync line format with lines that are displayed
I looked at a few editors, and most of the handle this by making the line number width for all lines match the amount of digits in the last line of the buffer. Some base it of the visual lines on the screen(if you can see a higher digit), but it's fully customizable via a minor mode now so people can change it if they wish.
Before:
After: