Bug 401475 - New line added on EOF
Summary: New line added on EOF
Status: RESOLVED WORKSFORME
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: 18.08.1
Platform: Other Linux
: NOR minor
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-27 15:58 UTC by saif1988
Modified: 2018-11-28 17:12 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description saif1988 2018-11-27 15:58:17 UTC
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
Comment 1 Thomas Surrel 2018-11-27 16:31:31 UTC
This is a setting you can modify in Configure Kate > Open/Save > General > Append newline at end of file on save
Comment 2 Thomas Surrel 2018-11-27 16:35:01 UTC
Sorry, I overlooked the fact that you were talking about kwrite.
Comment 3 Nate Graham 2018-11-27 20:52:37 UTC
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.
Comment 4 Kåre Särs 2018-11-28 07:08:29 UTC
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
Comment 5 saif1988 2018-11-28 10:19:38 UTC
Isn't this a horrible default? Not knowing that saving the file changes your data?
Comment 6 Christoph Feck 2018-11-28 17:08:25 UTC
No it isn't. What's horrible is when people have text files where all lines are terminated, but not the last line.
Comment 7 Nate Graham 2018-11-28 17:12:15 UTC
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 :)