Bug 473248

Summary: malfunction with BASH's default edit-and-execute-command ability (CTRL+X+E)
Product: [Applications] kate Reporter: witchhunter <witchhunterpro>
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 23.07.80   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description witchhunter 2023-08-10 15:35:06 UTC
SUMMARY

Hi,
BASH's shortcut CTRL+X+E evoke build-in functionality "edit-and-execute-command", to open a text editor and easily edit the current terminal input line.
It will open text editor firstly defined by a BASH's VISUAL variable. If VISUAL is set to Kate, the window does open, with the title of the temporary file /tmp/bash-fc.******, but the window do not contain terminal's current input line. It is empty instead and the command in terminal is executed **immediately** instead.
Next, I disabled all plugins in Kate and try again, but the same thing happens.
If VISUAL is set to KWrite, everything works just fine.


Next I tried to monitor the /tmp folder for changes and the following output emerge:

$ gio monitor /tmp
/tmp: /tmp/bash-fc.ucBQgP: created
/tmp: /tmp/bash-fc.ucBQgP: changed
/tmp: /tmp/bash-fc.ucBQgP: changes done
/tmp: /tmp/bash-fc.ucBQgP: deleted
/tmp: /tmp/qipc_systemsem_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: created
/tmp: /tmp/qipc_systemsem_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: changes done
/tmp: /tmp/qipc_systemsem_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: deleted
/tmp: /tmp/qipc_systemsem_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: created
/tmp: /tmp/qipc_systemsem_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: changes done
/tmp: /tmp/qipc_sharedmemory_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: created
/tmp: /tmp/qipc_sharedmemory_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: changes done
/tmp: /tmp/.sJEZWJ: created
/tmp: /tmp/.sJEZWJ: changes done
/tmp: /tmp/.sJEZWJ: attributes changed
/tmp: /tmp/zV24DdHIsp+rmyBO7B2YIzCaFm6g_FtFEXTDoqwkIes=: moved in
/tmp: /tmp/.sJEZWJ: deleted


And when the Kate's window is closed, the command continues:

/tmp: /tmp/zV24DdHIsp+rmyBO7B2YIzCaFm6g_FtFEXTDoqwkIes=: deleted
/tmp: /tmp/qipc_sharedmemory_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: deleted
/tmp: /tmp/qipc_systemsem_zVDdHIsprmyBOBYIzCaFmgFtFEXTDoqwkIes5944f7e34559639eb7e08b12675dbc30b4a2bc4e: deleted


STEPS TO REPRODUCE
1.  set Kate as VISUAL editor
2.  Type some command in Konsole
3.  Press CTRL+X+E to open Kate and edit the command

OBSERVED RESULT
The command in terminal is executed immediately.
Kate window will open but empty.

EXPECTED RESULT
The command in terminal  should show up in Kate. 
The command in terminal should wait for editing and saving in Kate.  

SOFTWARE/OS VERSIONS
Operating System: KDE neon Testing Edition
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Kernel Version: 6.2.0-26-generic (64-bit)
Graphics Platform: X11
Comment 1 Christoph Cullmann 2023-08-13 16:54:35 UTC
I think you need to set it to 'kate -b', else the call will not block.