History

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

mrsdizzie committed 6 years ago

Commit a6168fa1 parent cedbd367 files · +27 −10Browse files

Showing the changes to services/gitdiff/gitdiff.go (1 of 7 files). Show all

Unified · Split

services/gitdiff/gitdiff.go+3−3
@@ -269,20 +269,20 @@ func (diffSection *DiffSection) GetComputedInlineDiffFor(diffLine *DiffLine) tem · 268 unmodified lines
269269 case DiffLineAdd:
270270 compareDiffLine = diffSection.GetLine(DiffLineDel, diffLine.RightIdx)
271271 if compareDiffLine == nil {
272− return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]+"\n"))
272+ return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]))
273273 }
274274 diff1 = compareDiffLine.Content
275275 diff2 = diffLine.Content
276276 case DiffLineDel:
277277 compareDiffLine = diffSection.GetLine(DiffLineAdd, diffLine.LeftIdx)
278278 if compareDiffLine == nil {
279− return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]+"\n"))
279+ return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]))
280280 }
281281 diff1 = diffLine.Content
282282 diff2 = compareDiffLine.Content
283283 default:
284284 if strings.IndexByte(" +-", diffLine.Content[0]) > -1 {
285− return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]+"\n"))
285+ return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content[1:]))
286286 }
287287 return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content))
288288 }