https://bugs.kde.org/show_bug.cgi?id=491841
Bug ID: 491841 Summary: Duplicated text when formatting Python without a trailing newline Classification: Applications Product: kate Version: 23.08.5 Platform: Kubuntu OS: Linux Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: kwrite-bugs-n...@kde.org Reporter: dragorn...@gmail.com Target Milestone: --- SUMMARY Code is duplicated when formatting Python source with the last line not being empty STEPS TO REPRODUCE 1. create a file with content `print ()\na = 1` (where \n stands for a newline) NOTE: no trailing newline, the file should contain exactly those two lines and no empty one at the end 2. run format (Ctrl+T,F by default) 3. the file is now `a = 1\nprint ()\na = 1` instead of `print()\na = 1\n` OBSERVED RESULT Not formatted and with a line having been duplicated: `a = 1\nprint ()\na = 1` EXPECTED RESULT formatted and no duplicate: `print()\na = 1\n` SOFTWARE/OS VERSIONS Operating System: Kubuntu 24.04 KDE Plasma Version: 5.27.11 KDE Frameworks Version: 5.115.0 Qt Version: 5.15.13 ADDITIONAL INFORMATION - -- You are receiving this mail because: You are watching all bug changes.