Description
Description
(I was occasionally abrasive in some comments, I apologize. 🌸 )
Gitea shows a wrong amount of lines for both Unix and Windows/DOS line breaks in the web UI in both edit and code view, and in a very different and inconsistently wrong manner.
-
https://try.gitea.io/blablablablab/BlaTest/src/branch/main/unix.c This file has one line. A unix
\n
semantically terminates the previous line, so if a file ends in\n
then that means no line is coming after. Code view shows 1 line 🆗 correctly, but the "Edit" button shows 2 lines 🚫 wrongly.The Unix line break file authoritatively shown by Unix file editor vim, clearly just one line:
-
https://try.gitea.io/blablablablab/BlaTest/src/branch/main/windows.c This file has three lines. A Windows/DOS
\r\n
semantically separates two lines, so if a file ends in\r\n
then that means a blank line is coming after. Code view shows 2 lines 🚫 wrongly, but the "Edit" button shows 3 lines 🆗 correctly.The Windows/DOS line break file authoritatively shown by Windows file editor notepad.exe, clearly three lines:
wc -l
command, which counts line breaks characters and not lines, so it doesn't give correct line counts for Windows/DOX files. Get the correct lines displayed reliably: always check Windows/DOS \r\n
line break files with notepad.exe on Windows, and always check Unix \n
line break files with vim on Linux to show the correct amount of lines there. Or check with a hex editor what's really going on per file.
Gitea Version
1.22.0+dev-74-g4ab597f47
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
whatever is used on try.gitea.io
Operating System
whatever is used on try.gitea.io
How are you running Gitea?
it's on try.gitea.io
Database
None