Skip to content

Some keys print twice in the terminal on Windows with kitty enabled #4918

Description

@BDisp

Kitty only outputs CSI-u for regular inputs and not when the terminal outputs double keys. For example, with the PT keyboard, the keys «, », ç, Ç, º and ª are printed twice, obviously representing an unpleasant limitation.

Activity

  1. added a commit that references this issue on Apr 9, 2026
    9b29a74
  2. added theissue type on Apr 9, 2026
  3. added this to the V2 Release milestone on Apr 9, 2026
  4. added a commit that references this issue on Apr 11, 2026
    d27c18e
  5. added a commit that references this issue on Apr 11, 2026
    e532d61
  6. BDisp commented on Apr 11, 2026

    @BDisp
    MemberAuthor

    The commit e532d61 didn't fixed this issue in the develop branch. I only typed each key once.

    Image

  7. tig commented on Apr 11, 2026

    @tig
    Member

    The commit e532d61 didn't fixed this issue in the develop branch. I only typed each key once.

    Image Image

    I'm confused. You approved the PR. Did you actually test it?

  8. BDisp commented on Apr 11, 2026

    @BDisp
    MemberAuthor

    I'm confused. You approved the PR. Did you actually test it?

    I'm sorry, but I didn't have access to the machine at the time. From what I saw in the code, it seemed to suppress the second entry, and I thought it worked as expected. Today, I've already managed to test it and confirmed that it didn't fix the problem. I'll take a closer look and try to find a solution.

  9. reopened this on Apr 11, 2026
  10. tig commented on Apr 11, 2026

    @tig
    Member

    I'm confused. You approved the PR. Did you actually test it?

    I'm sorry, but I didn't have access to the machine at the time. From what I saw in the code, it seemed to suppress the second entry, and I thought it worked as expected. Today, I've already managed to test it and confirmed that it didn't fix the problem. I'll take a closer look and try to find a solution.

    I should have tested it too.

    I have a new laptop (mac book pro) that I'm using Parallels on. because of that, I have not had a chance to install the POR lang pack. I'll do so now.

  11. added a commit that references this issue on Apr 11, 2026
    329803e
  12. BDisp commented on Apr 11, 2026

    @BDisp
    MemberAuthor

    I found the cause. Add this line _pendingPrintableSuppression = key.GetPrintableText ();.

        /// <inheritdoc/>
        protected override bool ShouldSuppressFallbackKeyDown (Key key)
        {
            if (string.IsNullOrEmpty (_pendingPrintableSuppression))
            {
                _pendingPrintableSuppression = key.GetPrintableText ();
    
                return false;
            }
    
            string printableText = key.GetPrintableText ();
            bool suppress = string.Equals (printableText, _pendingPrintableSuppression, StringComparison.Ordinal);
            _pendingPrintableSuppression = string.Empty;
    
            return suppress;
        }
  13. BDisp commented on Apr 11, 2026

    @BDisp
    MemberAuthor

    Reopening this because the merge perhaps had some reference with this issue causing this closing.

  14. reopened this on Apr 11, 2026
  15. YourRobotOverlord commented on Aug 23, 2026

    @YourRobotOverlord
    Collaborator

    Reopening because fallback-only deduplication cannot be implemented safely with the current input representation.

    ConcurrentQueue<char> carries characters but no physical-key or terminal-source identity. Given two identical adjacent fallback characters, the input pipeline cannot distinguish duplicate terminal output from two intentional keypresses. Suppressing one therefore makes valid input lossy, as #5616 demonstrated.

    #5643 removes that raw/raw heuristic. It retains deduplication only when parser provenance identifies a kitty key event and the identical legacy fallback is the next logical key in the raw stream; timing and main-loop queue drains do not affect the result.

    A future fix for this issue needs terminal/source-level provenance before or alongside the queued characters (or equivalent physical-event identity). Timing windows, processing-batch boundaries, keyboard-layout/glyph lists, and platform checks cannot resolve the ambiguity reliably.

  16. BDisp commented on Aug 23, 2026

    @BDisp
    MemberAuthor

    This issue previously only occurred in Windows Terminal, which has since been fixed. When any of the keys «, », ç, Ç, º, and ª were pressed using a Portuguese (PT) keyboard, the input was not displayed in the Kitty CSI-u format and was therefore not recognized as such, but only as legacy entries without the Kitty CSI-u format, resulting in duplicate printing. Therefore, the unit test should contain an InjectRawSequence(\x1b[231::59;;231u", "ç", "ç"); input to differentiate between entries with the Kitty CSI-u format and other entries without it. The first item is a legitimate Kitty CSI-u format entry representing the pressing of the ç key, printing only once. The second and third items represent pressing and releasing the ç key, as they lack information about the key press/release, causing duplication on the screen. Thanks to the fix implemented by the Windows Terminal team, these keys are now recognized with the Kitty CSI-u format, along with the correct key press/release information.

  17. YourRobotOverlord commented on Aug 23, 2026

    @YourRobotOverlord
    Collaborator

    @BDisp So, if I understand, the correct fix should be to revert to the pre- #4949/#4977 state?

  18. BDisp commented on Aug 23, 2026

    @BDisp
    MemberAuthor

    @BDisp So, if I understand, the correct fix should be to revert to the pre- #4949/#4977 state?

    Probably yes, because with Kitty active I think all inputs will have to be in the Kitty CSI-u format, otherwise this problem may arise again. It would be best to ask a reliable AI to confirm if it's really as I said.

  19. added a commit that references this issue on Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions