https://bugs.kde.org/show_bug.cgi?id=524772

            Bug ID: 524772
           Summary: kitty keyboard protocol breaks fast synthetic Escape
                    keypresses in Neovim
    Classification: Applications
           Product: konsole
      Version First 26.08.0
       Reported In:
          Platform: EndeavourOS
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: keyboard
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
When the kitty keyboard protocol is enabled, Escape keydown/keyup events that
are sent in quick succession (less than 50ms between keydown and keyup) are
ignored by Neovim. The issue does not occur when using Vim in Konsole, or when
using Neovim in Alacritty or Kitty. Disabling the kitty keyboard protocol in
Konsole also resolves the issue. The physical Escape key works fine because the
time between keydown and keyup is greater than 50ms.

Background: I use the keyd keyboard remapper to configure the Caps Lock key to
act as Escape when tapped and Control when held. The Escape event sent by keyd
does not register in Neovim/Konsole due to the very short time between keydown
and keyup.


STEPS TO REPRODUCE
1. Ensure that kitty keyboard protocol is enabled in Konsole.
2. Install keyd and Neovim.
3. Create /etc/keyd/default.conf and enter the minimal configuration below.
4. Start/restart the keyd service.
5. In Konsole, type "nvim" to launch Neovim.
6. Press the "i" key to enter Insert Mode.
7. Press and release the Caps Lock key.

As an alternative to keyd, you can also use a tool such as ydotool to send a
synthetic Escape keyup/keydown sequence. The following command sends an Escape
keydown event immediately followed by an Escape keyup event. The initial sleep
command allows you to set focus to Neovim before the keyboard events are sent.

sleep 2 && ydotool key 1:1 1:0    # doesn't work
sleep 2 && ydotool key -d 100 1:1 1:0    # this works because of 100ms delay
between events

OBSERVED RESULT
Neovim does not leave Insert Mode.

EXPECTED RESULT
Neovim leaves Insert Mode.

SOFTWARE/OS VERSIONS
Operating System (available in the Info Center app, or by running `kinfo` in a
terminal window): EndeavourOS
KDE Plasma Version: 6.7.4
KDE Frameworks Version: 6.29.0
Qt Version: 6.11.2
Konsole Version: 26.08.0
Neovim Version: 0.12.5

ADDITIONAL INFORMATION
I don't know why this problem occurs in Neovim and not Vim, but it doesn't seem
to be a Neovim bug since it works fine in Alacritty and Kitty.

Using git bisect, I identified the commit that introduces the regression:

1983d2b47 Implement Kitty keyboard protocol

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to