Created attachment 1332070 [details]
How the file looks like in Vim
Description of problem:
A file with DOS line breaks shows no empty line at end of files, while Windows editors do.
Here is the file in exact byte contents:
jonas@cyberman:~$ hexdump test.txt
0000000 6261 0d63 640a 6665 0a0d
This shows up as attached in the notepad.png image on Windows (with a single line break).
However, in vim as attached in vim.png, while the file is clearly indicated to have dos line breaks, will show up with no empty line at the end.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create the above file e.g. with hex dump
2. Send yourself via e-mail or usb stick to a windows machine and open in Windows Notepad
3. Open it in vim
inconsistent rendering of Windows line breaks compared to actual Windows editors (which should IMHO be considered canonical source of how Windows line breaks behave)
consistent result with Windows editor of rendering and handling Windows line breaks
Created attachment 1332071 [details]
How the file looks like in Notepad
Sorry, the default format of hex dump doesn't show the \r\n sequences clearly. Here is a better format that shows the separate bytes:
jonas@cyberman:~$ hexdump -b test.txt
0000000 141 142 143 015 012 144 145 146 015 012
IMHO it is not a bug - displaying of files is AFAIK non-standardized (the fact Notepad does it in certain way it doesn't make it standard IMO) and it is in application's competency, how file will be displayed. IMO it would be bug if file in one format will be showed differently than in other format in same application (which I confirmed it is not the case - VIm behaves same for dos file or unix file) - user shouldn't notice that opened file is f.e. in dos file format (it is not relevant fact for user to see it is dos file or unix file).
VIm cursor seems to stay on last line (line with last CR+LF/CR/LF). Situation, which happens in Notepad, happens in VIm when you explicitly enter new line. If you really consider this issue as bug, contact VIm upstream on its github.
> displaying of files is AFAIK non-standardized
Actually in POSIX it is in regards to line breaks, which is why VIM displays it that way - however, applying POSIX interpretation to DOS line breaks is IMHO nonsensical.
I filed an upstream bug report here: https://github.com/vim/vim/issues/2179
Another small remark:
> user shouldn't notice that opened file is f.e. in dos file format (it is not relevant fact for user to see it is dos file or unix file).
The problem is that they will if they look close enough, since such a file will have an unexplained display difference to Microsoft Windows. Clearly goal of supporting DOS line breaks should be to get the same behavior as on the system where they originate from, shouldn't it?
Anyway, I suggest we wait to see what the upstream developers think of this
Sorry for the comment spam, but I linked the wrong upstream issue. Here is the correct link: https://github.com/vim/vim/issues/2183