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.
In a loop I am just printing the keys:
When I press the arrow keys to fast it creates a
KeyEscthat was never pressed.This is on macOS 14.15 go 1.22 at least.