aboutsummaryrefslogtreecommitdiffstats
path: root/templates/repo/view_file.tmpl
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-08-23 22:23:39 +0100
committerGitHub <noreply@github.com>2021-08-23 22:23:39 +0100
commitf31e7a67cfc9662af2ae2dab3f4687457545f60c (patch)
tree532a5e37ba751e710e1ee6ce271e2ac49026c6e7 /templates/repo/view_file.tmpl
parent73defbbd1c070930563f17daa9e540c44a127928 (diff)
downloadgitea-f31e7a67cfc9662af2ae2dab3f4687457545f60c.tar.gz
gitea-f31e7a67cfc9662af2ae2dab3f4687457545f60c.zip
Just use a slice when rendering file (#16774)
Highlight currently uses a map which is memory inefficient. Switch to use a slice instead. Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'templates/repo/view_file.tmpl')
-rw-r--r--templates/repo/view_file.tmpl3
1 files changed, 2 insertions, 1 deletions
diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl
index 8c73f1252b..b6198bd0e2 100644
--- a/templates/repo/view_file.tmpl
+++ b/templates/repo/view_file.tmpl
@@ -99,7 +99,8 @@
{{else}}
<table>
<tbody>
- {{range $line, $code := .FileContent}}
+ {{range $idx, $code := .FileContent}}
+ {{$line := Add $idx 1}}
<tr>
<td id="L{{$line}}" class="lines-num">
<span id="L{{$line}}" data-line-number="{{$line}}"></span>