https://bugs.kde.org/show_bug.cgi?id=450919
Bug ID: 450919 Summary: Kate adds newline at the end of file, and doesn't even show it Product: kate Version: 21.12.2 Platform: Other OS: Linux Status: REPORTED Severity: grave Priority: NOR Component: general Assignee: kwrite-bugs-n...@kde.org Reporter: php4...@gmail.com Target Milestone: --- Created attachment 147168 --> https://bugs.kde.org/attachment.cgi?id=147168&action=edit test file STEPS TO REPRODUCE 1. Open the attached txt file in Kate. This file has 4608 rows and 4607 newlines (not sure of which kind). It has NO newline at the end of the file 2. Without editing the file AT ALL, save it 3. close it and open it again OBSERVED RESULT When you save the file, a newline character is added for no reason at the end of the file, without warning. Worse than that, you can't even see it. If you move the cursor at the end of the file, there is no empty line at the end (just like there wasn't before saving). Kate has modified the file but you can't see it. But when you reopen it, you will see the empty line at the end in Kate. So not only Kate is modifying a file upon saving despite the fact that I have not touched it; and not only is it doing so silently. It is also inconsistent in how it shows the contents of the same file. After step 2 the newline at the end has already been added but can't be seen. After step 3 nothing has changed wrt after step 2, but now the empty line can be seen. EXPECTED RESULT 1. No change should be made to a file when saving it if I have done absolutely nothing in the editor. If I open a file and save it, it shouldn't be changed the slightest bit 2. If you have a good reason for changing a file that I haven't touched when I save it, you should warn me one way or another. You don't do that silently 3. If I close a file that I already saved and reopen it (meaning I am opening a file that is identical to how it was when I closed it), it should look the same, in every aspect, no matter what. If I don't see an empty line at the end before closing (and I repeat: after saving), than I shouldn't see an empty line at the end after reopening, given that the file hasn't been modified in the meantime. No matter how you choose to visually represent the presence or absence of a newline at the end of file (I don't think there's much ambiguity there actually, if there is a newline at the end I should see an empty line, I think that's all, but even if I'm missing something here), you must be consistent, and never ever should a file that hasn't changed look different. SOFTWARE/OS VERSIONS Operating System: openSUSE Tumbleweed 20220207 KDE Plasma Version: 5.24.0 KDE Frameworks Version: 5.90.0 Qt Version: 5.15.2 Kernel Version: 5.16.5-1-default (64-bit) Graphics Platform: X11 Processors: 8 × Intel® Core™ i7-1065G7 CPU @ 1.30GHz Memory: 7.3 GiB of RAM Graphics Processor: Mesa Intel® Iris® Plus Graphics -- You are receiving this mail because: You are watching all bug changes.