Skip to content

repeated KeyArrowDown/KeyArrowUp create a KeyEsc #41

@tcurdt

Description

@tcurdt

In a loop I am just printing the keys:

    if err := keyboard.Open(); err != nil {
        panic(err)
    }
    defer keyboard.Close()

    for {
        _, key, err := keyboard.GetKey()
        if err != nil {
            panic(err)
        }

        if key == keyboard.KeyEsc {
            fmt.Print("esc")
            break
        } else if key == keyboard.KeyEnter {
            fmt.Print("enter")
            break
        } else if key == keyboard.KeyArrowDown {
            fmt.Print("down")
        } else if key == keyboard.KeyArrowUp {
            fmt.Print("up")
        }
    }
downdowndowndowndowndowndownesc

When I press the arrow keys to fast it creates a KeyEsc that was never pressed.

This is on macOS 14.15 go 1.22 at least.

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