fix: keep deletion gutter marker visible when adjacent fold is collapsed#304996
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: keep deletion gutter marker visible when adjacent fold is collapsed#304996yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When a deletion occurs between two foldable regions, the deletion marker disappears when the region above is folded. This happens because the decoration range is a zero-width point on the last line of the fold. Fix by extending the deletion decoration range to include the start of the next line so the marker remains visible when the preceding line is hidden by folding. Closes microsoft#246388
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @lszomoruMatched files:
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
When a line is deleted between two foldable regions (e.g., between two
#regionblocks in HTML), the red deletion marker in the gutter disappears when the region above the deletion is folded. This happens because the deletion decoration is a zero-width range at the end of the last line of the fold, and that line becomes hidden when the fold is collapsed.Closes #246388
What is the new behavior?
The deletion decoration range now extends from the end of
startLineNumberto the beginning ofstartLineNumber + 1(when a next line exists). This ensures that if the line before the deletion is hidden by folding, the marker still appears on the next visible line.For the last line of the file (no next line), the behavior remains unchanged.
Additional context
QuickDiffDecorator.onDidChange()insrc/vs/workbench/contrib/scm/browser/quickDiffDecorator.tsChangeType.Deletecase is affected; Add and Modify decorations are unchangedisWholeLine: falseso it appears as the small deletion indicator, not a full-line decoration