summaryrefslogtreecommitdiffstats
path: root/templates/shared
diff options
context:
space:
mode:
authoryp05327 <576951401@qq.com>2024-03-06 16:24:43 +0900
committerGitHub <noreply@github.com>2024-03-06 07:24:43 +0000
commita2b0fb1a64b0794b808a013089758a49f56d8915 (patch)
tree39714ac6177b5dd29ad2c06960375e8f5d1bc42e /templates/shared
parent5cddab4f74bbb307ddf13e458c7ac22f93b9283a (diff)
downloadgitea-a2b0fb1a64b0794b808a013089758a49f56d8915.tar.gz
gitea-a2b0fb1a64b0794b808a013089758a49f56d8915.zip
Fix wrong line number in code search result (#29260)
Fix #29136 Before: The result is a table and all line numbers are all in one row. After: Use a separate table column for the line numbers. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'templates/shared')
-rw-r--r--templates/shared/searchfile.tmpl14
1 files changed, 14 insertions, 0 deletions
diff --git a/templates/shared/searchfile.tmpl b/templates/shared/searchfile.tmpl
new file mode 100644
index 0000000000..280584e4d1
--- /dev/null
+++ b/templates/shared/searchfile.tmpl
@@ -0,0 +1,14 @@
+<div class="file-body file-code code-view">
+ <table>
+ <tbody>
+ {{range .SearchResult.Lines}}
+ <tr>
+ <td class="lines-num">
+ <a href="{{$.RepoLink}}/src/commit/{{PathEscape $.SearchResult.CommitID}}/{{PathEscapeSegments $.SearchResult.Filename}}#L{{.Num}}"><span>{{.Num}}</span></a>
+ </td>
+ <td class="lines-code chroma"><code class="code-inner">{{.FormattedContent}}</code></td>
+ </tr>
+ {{end}}
+ </tbody>
+ </table>
+</div>