SUMMARY Opening a file in Kwrite always creates a new empty line at the end of the file (EOF) It is very annoying, particularly when working with strict file formats STEPS TO REPRODUCE 1. Create or Open any .txt file with kwrite 2. Go to last line, you'll see last line is blank 3. Delete last line and save 4. Re-open, you'll see that line again OBSERVED RESULT Last empty line always added EXPECTED RESULT Should not be there! I think this is a high priority issue. SOFTWARE/OS VERSIONS Windows: - MacOS: - Linux/KDE Plasma: Not sure, using Fedora 29 (available in About System) KDE Plasma Version: Not sure, using Fedora 29 KDE Frameworks Version: Not sure, using Fedora 29 Qt Version: Not sure, using Fedora 29 ADDITIONAL INFORMATION
This is a setting you can modify in Configure Kate > Open/Save > General > Append newline at end of file on save
Sorry, I overlooked the fact that you were talking about kwrite.
When working with strict file formats, one is typically using an advanced text edit (which is what Kate is) rather than the more simplistic KWrite. For the moment, you can simply use Kate instead of Kate and change this setting, as Thomas pointed out. However changing the default for KWrite seems like a reasonable enough request.
You have the option available also in KWrite. Settings -> Configure Editor... -> Open/Save -> General -> Automatic Cleanups on Save -> Append newline at end of file on save
Isn't this a horrible default? Not knowing that saving the file changes your data?
No it isn't. What's horrible is when people have text files where all lines are terminated, but not the last line.
Thankfully, since this is a user-configurable setting, we don't have to kill each other over it and everyone can have their own preference respected :)