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
269 case DiffLineAdd:269 case DiffLineAdd:
270 compareDiffLine = diffSection.GetLine(DiffLineDel, diffLine.RightIdx)270 compareDiffLine = diffSection.GetLine(DiffLineDel, diffLine.RightIdx)
271 if compareDiffLine == nil {271 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:]))
273 }273 }
274 diff1 = compareDiffLine.Content274 diff1 = compareDiffLine.Content
275 diff2 = diffLine.Content275 diff2 = diffLine.Content
276 case DiffLineDel:276 case DiffLineDel:
277 compareDiffLine = diffSection.GetLine(DiffLineAdd, diffLine.LeftIdx)277 compareDiffLine = diffSection.GetLine(DiffLineAdd, diffLine.LeftIdx)
278 if compareDiffLine == nil {278 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:]))
280 }280 }
281 diff1 = diffLine.Content281 diff1 = diffLine.Content
282 diff2 = compareDiffLine.Content282 diff2 = compareDiffLine.Content
283 default:283 default:
284 if strings.IndexByte(" +-", diffLine.Content[0]) > -1 {284 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:]))
286 }286 }
287 return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content))287 return template.HTML(highlight.Code(diffSection.FileName, diffLine.Content))
288 }288 }