This repository was archived by the owner on Sep 8, 2018. It is now read-only.
Position decoration at top of line number when the first line is deleted #146
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 the Change
This PR adds special handling for the first line of a file being deleted. Currently, the
git-line-removed
class always adds decoration to the bottom of the line number. This works well for everything except when the first line is deleted. In that case, we attempt to decorate row-1
, which gets clipped to0
. Then the decorations make it look like we've deleted the second line instead of the first. Now if we need to decorate row-1
, we instead addgit-previous-line-removed
class, which duplicates the existing style except for the positioning of the decoration.Benefits
Correctly indicates when the first line has been deleted.
Alternate Designs
We could have changed the
git-line-removed
styling to always apply to always render the decoration at the top and apply the decoration to the next line instead. That was a bigger change and seems like it could have issues at the end of the file instead.Possible Drawbacks
The duplicated style could maybe be done more elegantly with LESS. @simurai I'll defer to you on that on.
Applicable Issues
Closes #128