mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 11:28:24 +00:00 
			
		
		
		
	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  after fix  Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
This commit is contained in:
		| @@ -53,17 +53,17 @@ | |||||||
| 			<td colspan="2" class="lines-num"> | 			<td colspan="2" class="lines-num"> | ||||||
| 				<div class="code-expander-buttons" data-expand-direction="{{$expandDirection}}"> | 				<div class="code-expander-buttons" data-expand-direction="{{$expandDirection}}"> | ||||||
| 					{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} | 					{{if or (eq $expandDirection 3) (eq $expandDirection 5)}} | ||||||
| 						<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}}"> | 						<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}}"> | ||||||
| 							{{svg "octicon-fold-down"}} | 							{{svg "octicon-fold-down"}} | ||||||
| 						</button> | 						</button> | ||||||
| 					{{end}} | 					{{end}} | ||||||
| 					{{if or (eq $expandDirection 3) (eq $expandDirection 4)}} | 					{{if or (eq $expandDirection 3) (eq $expandDirection 4)}} | ||||||
| 						<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}}"> | 						<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}}"> | ||||||
| 							{{svg "octicon-fold-up"}} | 							{{svg "octicon-fold-up"}} | ||||||
| 						</button> | 						</button> | ||||||
| 					{{end}} | 					{{end}} | ||||||
| 					{{if eq $expandDirection 2}} | 					{{if eq $expandDirection 2}} | ||||||
| 						<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}}"> | 						<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}}"> | ||||||
| 							{{svg "octicon-fold"}} | 							{{svg "octicon-fold"}} | ||||||
| 						</button> | 						</button> | ||||||
| 					{{end}} | 					{{end}} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user