Bug 495749

Summary: Kate adds an unwanted carriage return when saving
Product: [Applications] kate Reporter: jimbo <loudsquid>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: normal CC: christoph, waqar.17a
Priority: NOR    
Version First Reported In: 24.08.2   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description jimbo 2024-11-03 13:50:00 UTC
I've stored a password in Kate that I need for accessing a database. It's a bit of a long and convoluted password so I store it in Kate so I can open it up use Ctrl + A and then select the whole thing. However I can't paste the password because Kate adds a carriage return to the file.

I've erased the carriage return and saved the file, but upon opening it has returned. This causes an issue because I can't Ctrl + A and copy the text without the carriage return present which means I can't paste it into the password prompt unless I manually select it. 

Why does Kate add this?

1. Open up Kate
2. Add a bunch of garbled text "jfasdiojbo435n43onk3"
3. Use Ctrl + A to select all
4. Notice it doesn't have a carriage return
5. Save the file and close it
6. Open the file and use Ctrl + A
7. The extra carriage return exists when it didn't in the previous file
Comment 1 jimbo 2024-11-03 13:51:36 UTC
Sorry to double post, but you don't need to save and close Kate. This occurs immediately after saving.
Comment 2 Christoph Cullmann 2024-11-03 15:25:29 UTC
See open/save settings, you can disable that there.

'Append newline at ....'
Comment 3 jimbo 2024-11-05 13:16:19 UTC
Thank you. I'll add this just to be specific,

Settings -> Configure Kate -> Open/Save (Automatic Cleanups on Save)
Append newline at end of file on save: Disable

Any reason as why this should be enabled on default? I understand removing trailing spaces, but I don't understand why appending a newline on save would even be an option. Thanks.
Comment 4 jimbo 2024-11-05 13:22:06 UTC
Might be a simple typo to fix there 'Automatic Cleanups on Save' probably should read 'Automatic Clean-up on Save'.
Comment 5 Waqar Ahmed 2024-11-05 13:34:17 UTC
> but I don't understand why appending a newline on save would even be an option. Thanks.

its a normal linux thing, and programming languages like C/C++ expect it as well.