From f6f4e1ddb97227f1d0f2213b6dc9201f302568cf Mon Sep 17 00:00:00 2001 From: confusedsushi Date: Tue, 1 Feb 2022 20:08:33 +0100 Subject: [PATCH] Fix review excerpt (#18502) Currently the "File Changed" tab of a PR is somehow broken. This is also true for the current release 1.16.0. When you are on the "File Changed" tab, and want to look at code excerpt before or after the code changes, the layout breaks. You can test this on try.gitea.io here: https://try.gitea.io/testnotexisting/magic_enum/pulls/2/files The problem occurs for the unified view and for the split view. Kind of the same problem was there for commenting a line of code, this was fixed in #18321 and #18403. For consistency, I changed the solution of #18321, I removed the ``colspan`` and instead added a ````. The goal was to have code similarly with the split view. Also the separator line in the split view was in the wrong column, this was fixed too.* more consistent unified review comment Fix #18516 Co-authored-by: Andrew Thornton --- templates/repo/diff/blob_excerpt.tmpl | 21 +++++++++------------ web_src/js/features/repo-issue.js | 4 +++- web_src/less/_repository.less | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index b3e80881fd..9bf0a7f990 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -21,23 +21,18 @@ {{$inlineDiff := $.section.GetComputedInlineDiffFor $line}}{{$inlineDiff.Content}} {{else}} + {{$inlineDiff := $.section.GetComputedInlineDiffFor $line}} + {{if and $line.LeftIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.LeftIdx}}{{end}} {{/* - */}}{{if $line.LeftIdx}}{{/* - */}}{{$inlineDiff := $.section.GetComputedInlineDiffFor $line}}{{$inlineDiff.Content}}{{/* - */}}{{else}}{{/* - */}}{{/* - */}}{{end}}{{/* - */}} + */}}{{if $line.LeftIdx}}{{$inlineDiff.Content}}{{end}}{{/* + */}} + {{if and $line.RightIdx $inlineDiff.EscapeStatus.Escaped}}{{end}} {{if $line.RightIdx}}{{end}} {{/* - */}}{{if $line.RightIdx}}{{/* - */}}{{$inlineDiff := $.section.GetComputedInlineDiffFor $line}}{{$inlineDiff.Content}}{{/* - */}}{{else}}{{/* - */}}{{/* - */}}{{end}}{{/* + */}}{{if $line.RightIdx}}{{$inlineDiff.Content}}{{end}}{{/* */}} {{end}} @@ -67,8 +62,10 @@ {{end}} + {{$inlineDiff := $.section.GetComputedInlineDiffFor $line}} + {{if $inlineDiff.EscapeStatus.Escaped}}{{end}} - {{$inlineDiff := $.section.GetComputedInlineDiffFor $line}}{{$inlineDiff.Content}} + {{$inlineDiff.Content}} {{end}} {{end}} diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index 7a62cf2701..69911a1734 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -505,7 +505,9 @@ export function initRepoPullRequestReview() { ` : ` - + + + `} `); diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index a2c40b3f0a..76ca5dff7d 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -3186,7 +3186,7 @@ td.blob-excerpt { background: var(--color-diff-inactive); } -.code-diff-split tbody tr td:nth-child(4) { +.code-diff-split tbody tr td:nth-child(5) { border-left: 1px solid var(--color-secondary); }