From a4f977e00b0b0a667d461b8f747c08dc58616c71 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Fri, 21 Jun 2024 04:33:51 +0800 Subject: [PATCH] Fix the wrong line number in the diff view page when expanded twice. (#31431) (#31440) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport #31431 by @charles7668 close #31149 The problem is caused by the `data-query=` string affecting the parsing of the `last_left` parameter. When the page is first rendered, `data-query=` does not exist. However, after clicking expand, the returned HTML contains this string, causing the line numbers to start from 1 upon expanding a second time. before fix ![圖片](https://github.com/go-gitea/gitea/assets/30816317/36842bde-cc30-43ba-91b0-c60a50a6dc0f) after fix ![圖片](https://github.com/go-gitea/gitea/assets/30816317/b73d7e40-ec01-48ae-9992-09c19ee477ad) Co-authored-by: charles <30816317+charles7668@users.noreply.github.com> --- templates/repo/diff/blob_excerpt.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index 2874ac6a55..cc2237029b 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -53,17 +53,17 @@
{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} - {{end}} {{if or (eq $expandDirection 3) (eq $expandDirection 4)}} - {{end}} {{if eq $expandDirection 2}} - {{end}}