This repository was archived by the owner on Sep 30, 2024. It is now read-only.
Diff view: fix line wrapping#58138
Merged
Merged
Conversation
Contributor
peterguy
approved these changes
Nov 7, 2023
peterguy
left a comment
Contributor
There was a problem hiding this comment.
Nice! Such a simple solution for a nagging problem.
461d7f4 to
47a4af7
Compare
This fixes line wrapping behavior in diff view. Previously, if a line didn't fit in the view, it would jump to a new line before properly wrapping. This made it look like the diff added a newline. The problem was that we're adding a diff marker (the plus/minus) in the gutter, but outside the div with `inline-block`, so the whole div was being pushed to the next line. Instead, if we move the `::before` selector to target the div with the content, the issue goes away. Because we cannot use a data attribute from a parent element in CSS, I also had to move `data-diff-marker` to the div that's being targeted.
47a4af7 to
2dc8399
Compare
vovakulikov
pushed a commit
that referenced
this pull request
Dec 12, 2023
This fixes line wrapping behavior in diff view. Previously, if a line didn't fit in the view, it would jump to a new line before properly wrapping. This made it look like the diff added a newline. The problem was that we're adding a diff marker (the plus/minus) in the gutter, but outside the div with `inline-block`, so the whole div was being pushed to the next line. Instead, if we move the `::before` selector to target the div with the content, the issue goes away. Because we cannot use a data attribute from a parent element in CSS, I also had to move `data-diff-marker` to the div that's being targeted.
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 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.
This fixes line wrapping behavior in diff view. Previously, if a line didn't fit in the view, it would jump to a new line before properly wrapping. This made it look like the diff added a newline.
The problem was that we're adding a diff marker (the plus/minus) in the gutter, but outside the div with
inline-block, so the whole div was being pushed to the next line. Instead, if we move the::beforeselector to target the div with the content, the issue goes away. Because we cannot use a data attribute from a parent element in CSS, I also had to movedata-diff-markerto the div that's being targeted.Fixes https://github.com/sourcegraph/sourcegraph/issues/57834
Test plan
See the before in the issue report. Here's the after:
CleanShot.2023-11-06.at.17.23.39.mp4