Skip to content

tty: Duplicate key events under Windows #1124

@JoeKar

Description

@JoeKar

Playing around with micro and its escape sequence change on top of v3.4.0 makes me think that there is something suspicious with the Windows abstraction tty_win.go (I also tried the pure v3.4.0).
Actually it looks like it generates a key press on press and on release, because every character I type (under Windows 11 with PowerShell in the Terminal) is duplicated in the moment I release the key.

I assume it is right when Windows reports the release in getConsoleInput(), but then it should be blocked in Read(b []byte) or additionally handled somewhere else.

The behavior looks exactly the same in jesseduffield/lazygit#5344.

Environment:

Microsoft Windows [Version 10.0.26200.8246]

Windows-Terminal
Version: 1.24.11321.0

Somehow related to this:
When opened in the same environment then micro will already be filled in the first line with input sneaking in from control sequences or something similar.

All of this doesn't happen when the Terminal was switched from the default PowerShell to the "classic" command prompt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions