Bug 2149844

Summary: Vim does not recognize key codes passed by Kitty terminal emulator
Product: [Fedora] Fedora Reporter: ho121 <3548216>
Component: vimAssignee: Karsten <karsten>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 37CC: ahlincq, ego.cordatus, gchamoul, karsten, michel, skoved, zawertun, zdohnal
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: vim-9.0.1006-1.fc37 vim-9.0.1006-1.fc36 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-07 01:35:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description ho121 2022-12-01 06:47:43 UTC
Description of problem:
Terminal vim `nmap` not working

Version-Release number of selected component (if applicable):
vim-X11.x86_64                                    2:9.0.963-1.fc37                  @updates              
vim-common.x86_64                                 2:9.0.963-1.fc37                  @updates              
vim-data.noarch                                   2:9.0.963-1.fc37                  @updates              
vim-enhanced.x86_64                               2:9.0.963-1.fc37                  @updates              
vim-filesystem.noarch                             2:9.0.963-1.fc37                  @updates              
vim-minimal.x86_64                                2:9.0.963-1.fc37                  @updates  

How reproducible:


Steps to Reproduce:
1. Open a terminal
2. Execute `vim --clean` 
3. Type `:nmap <F1> :q!<CR>` and press Enter.
4. Press F1 in vim normal mode.

Actual results:
vim not quit.

Expected results:
vim to quit

Additional info:
This affects vim and vimx, but not gvim.

Comment 1 Zdenek Dohnal 2022-12-01 08:21:13 UTC
Hi,

thank you for reporting the issue!

I have the same version on F36 and 'nmap' works there - I'm starting up F37 virt machine to check the issue straight on F37.

Comment 2 Zdenek Dohnal 2022-12-01 09:33:33 UTC
I'm sorry - I'm not able to reproduce the issue on F37 either, with the default Vim installation - I've tried running Vim in session through ssh and on a real F37, both worked fine.

Would you mind trying to reproduce the issue in a new environment, like VM? Ideally first in default environment and keyboard layout - GNOME and ENG US.

The only thing I can thing of is that your environment (keyboard, desktop environment) sends a different character codes than the default installation.

Comment 3 ho121 2022-12-01 12:59:57 UTC
Sorry, my bad.

I use kitty terminal. This only happens in kitty. Maybe it is a kitty bug.

Comment 4 Zdenek Dohnal 2022-12-02 10:31:20 UTC
I can't close Vim in that emulator - so it is definitely sending different key codes.

Switching to kitty to investigation - if I open Vim it generates the following messages (on F36):

[336 11:30:04.994164] [PARSE ERROR] Unrecognized DCS code: 0x7a
[336 11:30:04.994190] [PARSE ERROR] Unknown CSI code: 'm' with start_modifier: '' and end_modifier: '%' and parameters: '0'

Comment 5 skoved 2022-12-02 14:46:05 UTC
Hi I also use run vim from the kitty terminal (version 0.26.5-3.fc36). I'm currently on F36 and started encountering this issue with update of vim to 2:9.0.963-1.fc36 (issue goes away if I downgrade vim to 2:8.2.4621-1.fc36).

In trying to figure out what was going on I stumbled upon this issue [1] on the vim github repo. Based on this comment from the issue [2] it looks like there is a new version of vim that includes the fix for this issue.

1. https://github.com/vim/vim/issues/11638
2. https://github.com/vim/vim/issues/11638#issuecomment-1331155497

Comment 6 ahlinc 2022-12-04 23:29:31 UTC
Hi I use kitty and vim on 6.0.10-300.fc37.x86_64 and also can't exit from vim on the :q command.

~ # rpm -qa | grep -iP "kitty|vim"
kitty-terminfo-0.26.5-3.fc37.noarch
kitty-0.26.5-3.fc37.x86_64
vim-data-9.0.963-1.fc37.noarch
vim-filesystem-9.0.963-1.fc37.noarch
vim-common-9.0.963-1.fc37.x86_64
vim-enhanced-9.0.963-1.fc37.x86_64
vim-minimal-9.0.963-1.fc37.x86_64
~ # ls ~/Downloads/kitty-0.26.5-x86_64.txz

The problem doesn't exist if to use Kitty of the same version from an authors' build:
https://github.com/kovidgoyal/kitty/releases/download/v0.26.5/kitty-0.26.5-x86_64.txz

So the root of the problem may be is some library with which kitty was linked on Fedora.

Comment 7 Zdenek Dohnal 2022-12-05 07:13:28 UTC
Hi Sam,

thank you for letting me know!

I've tested the latest Vim patchlevel and the issue is fixed as you said. I'll build the newest Vim on F36+, because F35 is going to be EOL in a week.

In case there are two people who can test and give karma on F35, do let me know - I'll build Vim for F35 as well and create the update, if you are able to give it enough karma as soon as possible. I don't want to have the update hanging there after EOL if there is not enough karma to push it to the F35 stable.

Comment 8 Fedora Update System 2022-12-05 13:03:20 UTC
FEDORA-2022-1e14f3ae45 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-1e14f3ae45

Comment 9 Fedora Update System 2022-12-05 13:04:34 UTC
FEDORA-2022-fc4c513d06 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-fc4c513d06

Comment 10 Fedora Update System 2022-12-06 01:18:10 UTC
FEDORA-2022-fc4c513d06 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-fc4c513d06`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-fc4c513d06

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2022-12-06 01:32:13 UTC
FEDORA-2022-1e14f3ae45 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-1e14f3ae45`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-1e14f3ae45

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2022-12-07 01:35:56 UTC
FEDORA-2022-1e14f3ae45 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2022-12-08 01:56:02 UTC
FEDORA-2022-fc4c513d06 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.