From 9c8d2f7f996a104dbb5f7d636b3271ed9bb9af86 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Tue, 22 Oct 2019 16:18:52 -0700 Subject: [PATCH] Use splitlines() instead of split("\n") when displaying file contents Lines in a text file end with a newline, even the last one, so splitting by newline causes files viewed in git.sr.ht to appear as if they had an extra blank line at the end. Instead, use splitlines(), which handles the trailing newline correctly, as well as line end sequences used by other operating systems. --- gitsrht/templates/blob.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitsrht/templates/blob.html b/gitsrht/templates/blob.html index f04c288..2a0965c 100644 --- a/gitsrht/templates/blob.html +++ b/gitsrht/templates/blob.html @@ -69,7 +69,7 @@ pre, body {
{% for i in range(
         editorconfig.max_line_length()) %} {% endfor %}
-
{% for line in data.split("\n") %}{% for line in data.splitlines() %}{{loop.index}}{% if not loop.last %}
-- 
2.38.4