Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeated KeyArrowDown/KeyArrowUp create a KeyEsc #41

Open
tcurdt opened this issue Jul 19, 2024 · 0 comments
Open

repeated KeyArrowDown/KeyArrowUp create a KeyEsc #41

tcurdt opened this issue Jul 19, 2024 · 0 comments

Comments

@tcurdt
Copy link

tcurdt commented Jul 19, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant