Bug 510684

Summary: Using Escape in terminal/konsole loses focus
Product: [Applications] kate Reporter: tomashnyk
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: waqar.17a
Priority: NOR    
Version First Reported In: 25.08.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description tomashnyk 2025-10-16 14:24:56 UTC
STEPS TO REPRODUCE
1. In Configure Kate>Terminal, either unset "Hide Konsole on pressing 'Esc'" or use one of the files that are excepted (vim or git [commit] in my case)
2. Press Escape

OBSERVED RESULT
Konsole does not close (good) but looses focus (bad).

EXPECTED RESULT
Konsole keeps focus so I can type :w to save the file.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 42
KDE Plasma Version: 6.4.5
KDE Frameworks Version: 6.20.0
Qt Version: 6.9.2
Kernel Version: 6.16.8-200.fc42.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × Intel® Core™ i9-9880H CPU @ 2.30GHz
Memory: 64 GiB of RAM (62.5 GiB usable)
Graphics Processor 1: Intel® UHD Graphics 630
Graphics Processor 2: NVIDIA GeForce GTX 1650 with Max-Q Design
Manufacturer: LENOVO
Product Name: 20QVS0FP00
System Version: ThinkPad X1 Extreme 2nd

ADDITIONAL INFORMATION
I seem not to be the only one with this: https://www.reddit.com/r/kde/comments/17nfxlr/comment/lxygub1/
Comment 1 Waqar Ahmed 2025-10-22 05:54:19 UTC
> unset "Hide Konsole on pressing 'Esc'"

Cannot reproduce with this case.
Comment 2 Waqar Ahmed 2025-10-22 05:59:03 UTC
> or use one of the files that are excepted (vim or git [commit] in my case)

Can't reproduce with this as well.
Comment 3 Waqar Ahmed 2025-10-22 06:18:59 UTC
Git commit 610f0816786fb944d9f7e26517072b5bbebde85e by Waqar Ahmed.
Committed on 22/10/2025 at 06:18.
Pushed by waqar into branch 'master'.

Fix Context toolview steals focus

We should only handle Esc if the toolview is visible

M  +1    -1    apps/lib/texthint/hintview.cpp

https://invent.kde.org/utilities/kate/-/commit/610f0816786fb944d9f7e26517072b5bbebde85e
Comment 4 Waqar Ahmed 2025-10-22 06:21:18 UTC
I found one case which leads to this issue and fixed it. If the Context toolview was enabled then it would steal focus. (It is enabled in Configure Kate -> Behaviour Page -> Context -> Enable tool view.

If you don't have this enabled, then the issue might be somewhere else and we'll need to investigate a bit more.
Comment 5 tomashnyk 2025-10-22 13:40:17 UTC
Yes, I had that setting enabled and when I built Kate from git, the issue is gone. Thank you, this was fast!

Not sure why I had that setting on in the first place. I do not understand at all what is toolview supposed to do or where is it suppose to display anything :-).
Comment 6 Waqar Ahmed 2025-10-31 06:35:56 UTC
Git commit a254ff1be34bd6e40ea79e558248c2f0166ad24b by Waqar Ahmed.
Committed on 31/10/2025 at 06:31.
Pushed by waqar into branch 'release/25.08'.

Fix Context toolview steals focus

We should only handle Esc if the toolview is visible
(cherry picked from commit 610f0816786fb944d9f7e26517072b5bbebde85e)

M  +1    -1    apps/lib/texthint/hintview.cpp

https://invent.kde.org/utilities/kate/-/commit/a254ff1be34bd6e40ea79e558248c2f0166ad24b