PR: Shift maximum character edge line to match editor characters #16277
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.
Description of Changes
The vertical line indicating the maximum characters per line (edge line) is shifted 3 units to the right so that it aligns with the characters of the editor.
Current behavior:
Shifting line to the right by 3 units:
This is tested also for other font sizes (7-16) and works well, as well as other standard monospace fonts shipping with Windows.
Why shift by 3?
I tested with 3 first based on this being added to the line number margin
spyder/spyder/plugins/editor/panels/linenumber.py
Line 186 in bb2ed9a
And it works quite well, by chance I suppose. I also tried removing the 3 from the line number margin (without shifting edge line), but this has no effect.
An alternative solution which also appears to work quite well is to shift the line relative to the character width. Might be more robust for different (odd) fonts/resolutions. To keep this simple fix very simple I stuck with shifting 3 units as it appears to work well across sizes and fonts. Example shifting 1/3rd of a character width, an appropriate number is probably between 1/3 and 1/2.
Issue(s) Resolved
Fixes #16248
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct: Reinert Huseby Karlsen