[UI] Do not include trailing EOL character when counting lines

- Adjust the counting of the number of lines of a file to match the
amount of rendered lines. This simply means that a file with the content
of `a\n` will be shown as having `1 line` rather than `2 lines`. This
matches with the amount of lines that are being rendered (the last empty
line is never rendered) and matches more with the expecation of the
user (a trailing EOL is a technical detail).
- In the case there's no EOL, the reason why it was counting
'incorrectly' was to show if there was a trailing EOL or not, but now
text is shown to tell the user this.
- Integration test added.
- Resolves Codeberg/Community#1612
This commit is contained in:
Gusted 2024-08-06 01:27:38 +02:00
parent 641b0f74b6
commit 5cf976739c
No known key found for this signature in database
GPG key ID: FD821B732837125F
5 changed files with 88 additions and 7 deletions

View file

@ -1331,6 +1331,8 @@ normal_view = Normal View
line = line
lines = lines
from_comment = (comment)
no_eol.text = No EOL
no_eol.tooltip = This file doesn't contain a trailing end of line character.
editor.add_file = Add file
editor.new_file = New file