Bug 468385

Summary: Interprete LF as line terminator instead of line separator
Product: [Applications] kate Reporter: Christian Stoller <christian.stoller>
Component: kwriteAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: waqar.17a
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Christian Stoller 2023-04-11 09:13:03 UTC
SUMMARY
-------
In Linux the LF character is not regarded as a line seperator, but as a line terminator, where all valid lines should end with LF. You can read more about that distinction at https://en.wikipedia.org/wiki/Newline#Interpretation.

If you create an empty file on Linux in Kate, insert some characters (without pressing return key) and save, it won't add the line terminator LF. But this should be done on linux text files (see https://superuser.com/a/745135/248359 or https://vi.stackexchange.com/a/11630).

The current behaviour leads to issues when you are using tools like cat or Git.

STEPS TO REPRODUCE
------------------
1. Create an empty file in Kate and enter "TEST" without pressing the return key
2. Save the file

OBSERVED RESULT
---------------
Running `cat file_created_by_kate.txt` at the terminal will output

> naitsirch@linux1:~$ cat file_created_by_kate.txt
> TESTnaitsirch@linux1:~$

EXPECTED RESULT
---------------
> naitsirch@linux1:~$ cat file_created_by_kate.txt
> TEST
> naitsirch@linux1:~$

SOFTWARE/OS VERSIONS
--------------------
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel-Version: 5.10.0.9-amd64
Comment 1 Waqar Ahmed 2023-04-11 09:25:35 UTC
Open Kate settings (Ctrl + ,), search for "Append new line" and check this setting
Comment 2 Christian Stoller 2023-04-11 15:10:20 UTC
Sorry, I did not know about this setting. Thanks for your hint.