Skip to content

Commit a4f977e

Browse files
Fix the wrong line number in the diff view page when expanded twice. (#31431) (#31440)
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 <[email protected]>
1 parent b83482b commit a4f977e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templates/repo/diff/blob_excerpt.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@
5353
<td colspan="2" class="lines-num">
5454
<div class="code-expander-buttons" data-expand-direction="{{$expandDirection}}">
5555
{{if or (eq $expandDirection 3) (eq $expandDirection 5)}}
56-
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?data-query={{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}">
56+
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=down&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}">
5757
{{svg "octicon-fold-down"}}
5858
</button>
5959
{{end}}
6060
{{if or (eq $expandDirection 3) (eq $expandDirection 4)}}
61-
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?data-query={{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}">
61+
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=up&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}">
6262
{{svg "octicon-fold-up"}}
6363
</button>
6464
{{end}}
6565
{{if eq $expandDirection 2}}
66-
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?data-query={{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}">
66+
<button class="code-expander-button" hx-target="closest tr" hx-get="{{$.RepoLink}}/blob_excerpt/{{PathEscape $.AfterCommitID}}?{{$line.GetBlobExcerptQuery}}&style=unified&direction=&wiki={{$.PageIsWiki}}&anchor={{$.Anchor}}">
6767
{{svg "octicon-fold"}}
6868
</button>
6969
{{end}}

0 commit comments

Comments
 (0)