Bug 510587

Summary: Identation broken in terminal
Product: [Applications] kate Reporter: Olga Baranov <olga.baranov>
Component: indentationAssignee: KWrite Developers <kwrite-bugs-null>
Status: REOPENED ---    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 23.08.5   
Target Milestone: ---   
Platform: Flatpak   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Olga Baranov 2025-10-14 08:09:51 UTC
SUMMARY

When sending indented text block to interactive console (via key shortcut in Python), each line is indented one level further, breaking the code in python 

STEPS TO REPRODUCE
1. Create an indented block in py-file
(e.g.
def test(a):
    print('1')
    print('2')
    print('3')
)
2. Send to python terminal via key shortcut

OBSERVED RESULT

in the terminal, following is seen : 

>>> def test(a):
...         print('1')
...             print('2')
...                 print('3')
...                 
  File "<python-input-1>", line 3
    print('2')
IndentationError: unexpected indent
>>> 

EXPECTED RESULT
normal execution with indentation kept as in the editor 

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Ubuntu 24.04.3 LTS
KDE Frameworks Version: none installed i guess (kio: 5.115.0-0ubuntu6)
Qt Version: 5.15.13 

ADDITIONAL INFORMATION
There was a similar discussion in vscode github, where  the issue seems to be fixed: https://github.com/microsoft/vscode-python/issues/24256
Comment 1 Bug Janitor Service 2025-10-22 06:36:09 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/kate/-/merge_requests/1926
Comment 2 Waqar Ahmed 2025-10-22 18:30:31 UTC
Git commit 9fd32cb6bca0a6f6aaa87f5fbda8d35aad218d67 by Waqar Ahmed.
Committed on 22/10/2025 at 17:53.
Pushed by cullmann into branch 'master'.

bracketed paste when piping text to the terminal

M  +5    -1    addons/konsole/kateconsole.cpp

https://invent.kde.org/utilities/kate/-/commit/9fd32cb6bca0a6f6aaa87f5fbda8d35aad218d67