Bug 410446 - "Append newline at the end of file on save" option does not work
Summary: "Append newline at the end of file on save" option does not work
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: general (other bugs)
Version First Reported In: Git
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-31 10:52 UTC by Eugene Shalygin
Modified: 2019-08-08 18:33 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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...