Bug 446355

Summary: Esc key closes terminal panel when Vim is open in Insert mode when using Git.
Product: [Applications] kate Reporter: daobrien
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: altern.ez, silopolis, waqar.17a
Priority: NOR    
Version First Reported In: 21.08.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description daobrien 2021-12-02 02:04:49 UTC
SUMMARY

I use Kate to edit XML and DocBook files on a daily basis. As required, I open the Terminal panel and run `git commit`, which opens Vim. Normally I enter a commit message and press Esc, and then `:wq`. Everything "just works".
Yesterday I upgraded to Fedora 34. Now when I try to enter a commit message, when I press `Esc` the Terminal panel just closes, but the Vim session stays open (you can find it with `ps`). I've searched all the Kate shortcuts to see if `Esc` was mapped to something but can't see it.

This only seems to happen when I use `git commit`.

STEPS TO REPRODUCE
I can do this:
- F7 to open the terminal panel in Kate.
- `vi my-file` to open a new file.
- `i` to start editing stuff.
- `Esc` to exit insert mode and proceed as normal.

But, if I open the terminal panel and do git commit dir-name/ (as per normal) and then go into insert mode, I can't get out again.
 

OBSERVED RESULT
In the Terminal panel, `git commit <dir>` opens Vim. I can change to Insert mode but I cannot Escape from Insert mode.

EXPECTED RESULT
The `Esc` key should exit Insert mode and allow `:wq` etc., as normal. This has always worked before.

SOFTWARE/OS VERSIONS

Fedora 34
Gnome4
KDE Frameworks Version:  Don't know
Qt Version: qt-4.8.7-61.fc34.x86_64 (Is that what you need?)

ADDITIONAL INFORMATION
Comment 1 Waqar Ahmed 2021-12-02 05:18:26 UTC
Go to "Settings->Terminal->"Hide Konsole On Esc press". Add "git" to the list of programs at the bottom.
Comment 2 daobrien 2021-12-02 11:48:53 UTC
(In reply to Waqar Ahmed from comment #1)
> Go to "Settings->Terminal->"Hide Konsole On Esc press". Add "git" to the
> list of programs at the bottom.

That solved it, thanks!
(Although it was "Settings > Configure Kate > Terminal..." to get to that dialog box.)

Thanks very much.
Comment 3 silopolis 2022-06-17 14:50:43 UTC
Hi,

Running 22.04.1 on Debian Testing I had a similar behavior.

As this was apparently already set. I thought I had to add `vim.nox` to the list too but didn't seem to work (I didn't restart kate). Then tried a couple of things each time launching a new Kate... And it seems to me that it was only when I unchecked and checked back the `Hide Konsole on Esc` box and applied that it finally behaved as intended.

In the end the original Kate instance finally worked, without restarting, and back with the original settings !

TY
J
Comment 4 Waqar Ahmed 2022-07-06 06:47:23 UTC
Git commit 356278ab2459d32a3f20124be8bd0f05398a4c3c by Waqar Ahmed.
Committed on 06/07/2022 at 06:46.
Pushed by waqar into branch 'master'.

Add git to the list of 'Esc' exceptions

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

https://invent.kde.org/utilities/kate/commit/356278ab2459d32a3f20124be8bd0f05398a4c3c
Comment 5 Alberto Egurrola 2022-08-02 21:43:50 UTC
Is there a similar option to keep other tabs open (like LSP, Search, ctags, etc.) when unsing vi-mode and pressing <ESC>? The solution for terminal tab works fine but the other tabs keep getting closed, even using remaps keys in vi-mode settings.