mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	Backport #28454 (the only conflict is caused by some comments) * Close #24483 * Close #28123 * Close #23682 * Close #23149
This commit is contained in:
		| @@ -285,15 +285,15 @@ type DiffInline struct { | ||||
|  | ||||
| // DiffInlineWithUnicodeEscape makes a DiffInline with hidden unicode characters escaped | ||||
| func DiffInlineWithUnicodeEscape(s template.HTML, locale translation.Locale) DiffInline { | ||||
| 	status, content := charset.EscapeControlHTML(string(s), locale) | ||||
| 	return DiffInline{EscapeStatus: status, Content: template.HTML(content)} | ||||
| 	status, content := charset.EscapeControlHTML(s, locale) | ||||
| 	return DiffInline{EscapeStatus: status, Content: content} | ||||
| } | ||||
|  | ||||
| // DiffInlineWithHighlightCode makes a DiffInline with code highlight and hidden unicode characters escaped | ||||
| func DiffInlineWithHighlightCode(fileName, language, code string, locale translation.Locale) DiffInline { | ||||
| 	highlighted, _ := highlight.Code(fileName, language, code) | ||||
| 	status, content := charset.EscapeControlHTML(highlighted, locale) | ||||
| 	return DiffInline{EscapeStatus: status, Content: template.HTML(content)} | ||||
| 	return DiffInline{EscapeStatus: status, Content: content} | ||||
| } | ||||
|  | ||||
| // GetComputedInlineDiffFor computes inline diff for the given line. | ||||
|   | ||||
| @@ -93,10 +93,10 @@ func (hcd *highlightCodeDiff) diffWithHighlight(filename, language, codeA, codeB | ||||
| 	highlightCodeA, _ := highlight.Code(filename, language, codeA) | ||||
| 	highlightCodeB, _ := highlight.Code(filename, language, codeB) | ||||
|  | ||||
| 	highlightCodeA = hcd.convertToPlaceholders(highlightCodeA) | ||||
| 	highlightCodeB = hcd.convertToPlaceholders(highlightCodeB) | ||||
| 	convertedCodeA := hcd.convertToPlaceholders(string(highlightCodeA)) | ||||
| 	convertedCodeB := hcd.convertToPlaceholders(string(highlightCodeB)) | ||||
|  | ||||
| 	diffs := diffMatchPatch.DiffMain(highlightCodeA, highlightCodeB, true) | ||||
| 	diffs := diffMatchPatch.DiffMain(convertedCodeA, convertedCodeB, true) | ||||
| 	diffs = diffMatchPatch.DiffCleanupEfficiency(diffs) | ||||
|  | ||||
| 	for i := range diffs { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user