add file line count info on UI (#8396)

Also reworked the header to remove the filename (which is redundant with
the file path above) and made the header a flexbox with a monospace
font.

Fixes: https://github.com/go-gitea/gitea/issues/8170
This commit is contained in:
silverwind 2019-10-07 06:59:17 +02:00 committed by techknowlogick
parent 51fade4c44
commit 08896cd9f6
5 changed files with 69 additions and 43 deletions

View file

@ -304,6 +304,8 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
var output bytes.Buffer
lines := strings.Split(fileContent, "\n")
ctx.Data["NumLines"] = len(lines)
//Remove blank line at the end of file
if len(lines) > 0 && lines[len(lines)-1] == "" {
lines = lines[:len(lines)-1]