-
Notifications
You must be signed in to change notification settings - Fork 34.8k
Optimized: Allowing to define variable line heights #241218
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Decorations may affect line wrapping. For example, they make make the text bold, or increase or decrease font size. This wasn’t originally taken into account to calculate the the break offsets.
…ing lines inside a multi-line decoration
alexdima
approved these changes
Apr 14, 2025
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.
Follow-ups:
codeEditorWidget.ts
:getLineHeightForLineNumber
will return non 0 values for folded lines- top of viewport is not preserved when custom line heights are changed (like we do in wrapping)
- side-by-side diff editors won't align anymore
bpasero
approved these changes
Apr 14, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
fixes #147067
Test pass 1:
Verify the following cases:
Show Editor Context Menu
makes context menu appear at the correct location🐛 Because different line heights, the cursor is placed behind the sticky widget in certain cases. In our reveal logic we add as a padding top maxStickyLines * lineHeight but in our case line height can be variable.
To discuss
Diffs are not correctly aligned in a diff editor on either side when special line heghts are set ever since we have made line height define per editor and not per text model. We can see it in the following case:
In the right editor the line heights are larger than the in left editor hence the diffs are no longer aligned. To mitigate this we have several options:
As well as this, since the line heights are set per editor, from the diff editor, when you click on
Toggle Collpased Unchaned Regions
, this opens a diff editor where the line heights are the default ones. This is inconsistent user experience.Issue discovered that should be fixed separately:
When revealing a line for example by using the cursor up comman, the cursor can end up below the sticky scroll widget which has the modified line height. This happens because we set as the padding:
maxNumberOfStickyLines * lineHeight
. In our case however lineHeight can be larger than the default line height, and so the padding is not enough, hence the cursor appears below the sticky widget. To fix this, I will have to redefine how view lines interact with the sticky scroll widget.