-
Notifications
You must be signed in to change notification settings - Fork 58
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
issue using GetSingleKey #34
Comments
I am experiencing the same problem. Key presses with GetSingleKey return a ch rune with values from the previous key press. The older version suggested by @PG-0126 works as expected. |
Same here. I am experiencing a same issue. So there is a gap for the first input when it takes the "GetStringKey". Therefore, the first keystroke is being ignored. |
I am able to reproduce this problem on Windows, in the Git Bash shell and in VSCode's terminal. Works correctly on Linux, macOS, Windows CMD, and Windows Powershell. |
The last working version seems "Pass alt combinations through as Key+Rune (#23)". You can use it like this:
This bug gets introduced in one of these two commits: |
version - github.com/eiannone/keyboard v0.0.0-20220611211555-0d226195f203 (latest as of now) package main
import (
"fmt"
"log"
"github.com/eiannone/keyboard"
)
func main() {
err := keyboard.Open()
if err != nil {
log.Fatal(err)
}
defer func() {
_ = keyboard.Close()
}()
fmt.Println("Press any key on the keyboard. Press ESC to quit.")
for {
char, key, err := keyboard.GetSingleKey()
if err != nil {
log.Fatal(err)
}
if key != 0 {
fmt.Println("you pressed", char, key)
} else {
fmt.Println("You pressed", char)
}
if key == keyboard.KeyEsc {
break
}
}
fmt.Println("Program exiting...")
} Although it is not an issue in the version mentioned in your comment. |
GetSingleKey is not working properly in this new version.
It is not returning instantly.
Let me explain the whole scenario.....
suppose i press 'a'...
it will not detect nor display any result.
then suppose i press 'e' (or any random alphabet or key)
this time it displays the value of the previous action (i.e. value of 'a')
i hope u got it...
please fix this issue
following version works fine
github.com/eiannone/keyboard v0.0.0-20200508000154-caf4b762e807
but latest one is having issue
The text was updated successfully, but these errors were encountered: