Bug 410446

Summary: "Append newline at the end of file on save" option does not work
Product: [Applications] kate Reporter: Eugene Shalygin <eugene.shalygin+bugzilla.kde>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: nate
Priority: NOR    
Version First Reported In: Git   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Eugene Shalygin 2019-07-31 10:52:09 UTC
SUMMARY

The requested newline is not appended.

STEPS TO REPRODUCE
1. Enable the option.
2. Open any file.
3. Remove the last newline or write something at the end of the file.
4. Save the file 

OBSERVED RESULT

No newline added.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: git master
(available in About System)
KDE Plasma Version: git master
KDE Frameworks Version: git master
Qt Version: 5.12.4


P.S. It would be nice to get "Trim newlines at the end of file" option to ensure there is only single newline at the end of files.
Comment 1 Eugene Shalygin 2019-07-31 14:16:26 UTC
(In reply to Eugene Shalygin from comment #0)
The description is incorrect: saved file contains the newline at the end, it is just the editor which does not show it.
Comment 2 Dominik Haumann 2019-08-07 19:39:06 UTC
That is indeed by design, and we do not have any plans to change that.
Comment 3 Eugene Shalygin 2019-08-07 23:25:25 UTC
Why do you think this behaviour is not confusing for a plain-text editor?
Comment 4 Dominik Haumann 2019-08-08 18:33:23 UTC
Well, it does append a newline at the end of the file on save. Other editors like vim also don't necessarily show it. It doesn't make it wrong behavior.

This feature btw is mostly for old compilers that require a newline at eof since otherwise the code wouldn't compile...