Bug 453252

Summary: 'Append newline to file on save' moves cursor on save
Product: [Applications] kate Reporter: Kishore Gopalakrishnan <kishore96>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 22.04.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Kishore Gopalakrishnan 2022-05-01 06:22:14 UTC
SUMMARY
When Kate is set to append a newline to a file on save and the cursor is currently at the end of the file, the cursor moves to the next line when the user saves the file. 

STEPS TO REPRODUCE
1. Make sure Settings > Configure Kate> Open/Save > 'Append newline at end of file on Save' is enabled
2. Open any existing text file in Kate 
3. Type something on the empty last line
4. Place the cursor at the end of the newly typed last line
5. Press Ctrl+S (save)

OBSERVED RESULTS
Cursor is automatically moved to the newline that was inserted after the last line

EXPECTED RESULTS
Cursor should not be automatically moved when the user saves a file

SOFTWARE VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.3
Kernel Version: 5.15.36-1-lts (64-bit)
Graphics Platform: X11
Comment 2 Christoph Cullmann 2022-05-02 05:49:26 UTC
Git commit a1b91bacd3b919c41c68b3aed79577d2408e9564 by Christoph Cullmann.
Committed on 02/05/2022 at 05:34.
Pushed by cullmann into branch 'master'.

avoid cursor move on insert of line at EOF on save

M  +16   -0    src/document/katedocument.cpp

https://invent.kde.org/frameworks/ktexteditor/commit/a1b91bacd3b919c41c68b3aed79577d2408e9564