diff options
author | mrsdizzie <info@mrsdizzie.com> | 2020-07-08 17:02:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 22:02:38 +0100 |
commit | a6168fa25d0a7dfee689e1bce940557fff70d392 (patch) | |
tree | 6571fae3f1d73ffc9d3ace5ff3c3bcbf7c34909c /services | |
parent | cedbd3684fe76875c9ce3b2c12471db63a11f421 (diff) | |
download | gitea-a6168fa25d0a7dfee689e1bce940557fff70d392.tar.gz gitea-a6168fa25d0a7dfee689e1bce940557fff70d392.zip |
Make copy/paste work for source code (#12191)
* Make copy/paste work for source code
Fix regression casued by #12047 so copy/paste works properly in all browsers.
Fixes #12184
Also while looking at this I saw a small display issue for blame view. I think #12023 was merged into original PR through an update branch before #12047 was merged and made one of the css ruules not apply anymore.
* use pseudo-element to prevent copying of comment + symbol even when not visually selected
* remove added newline here should not be necessary anymore
* make sure empty line is newline so there is something to select and copy
Diffstat (limited to 'services')
-rw-r--r-- | services/gitdiff/gitdiff.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go index 80e6eb1ecd..d335661ffb 100644 --- a/services/gitdiff/gitdiff.go +++ b/services/gitdiff/gitdiff.go @@ -269,20 +269,20 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) tem case DiffLineAdd: compareDiffLine = diffSection.GetLine(DiffLineDel, diffLine.RightIdx) if compareDiffLine == nil { - return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]+"\n")) + return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:])) } diff1 = compareDiffLine.Content diff2 = diffLine.Content case DiffLineDel: compareDiffLine = diffSection.GetLine(DiffLineAdd, diffLine.LeftIdx) if compareDiffLine == nil { - return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]+"\n")) + return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:])) } diff1 = diffLine.Content diff2 = compareDiffLine.Content default: if strings.IndexByte(" +-", diffLine.Content[0]) > -1 { - return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]+"\n")) + return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:])) } return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content)) } |