Radish alpha
r
Radicle web interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
Check if there is a final new line in the blob content
Sebastian Martinez committed 3 years ago
commit 4f50b959cc62332577cd318f33378e8c6f7e0a4d
parent d45e21c82da10282fa0d701119f5c99b80d1138b
1 file changed +2 -1
modified src/base/projects/Blob.svelte
@@ -18,7 +18,8 @@

  const lastCommit = blob.info.lastCommit;
  const lines = blob.binary ? 0 : (blob.content.match(/\n/g) || []).length;
-
  const lineNumbers = Array(lines)
+
  const hasFinalNewline = blob.content.endsWith("\n");
+
  const lineNumbers = Array(hasFinalNewline ? lines : lines + 1)
    .fill(0)
    .map((_, index) => (index + 1).toString());
  const parentDir = blob.path