We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When defining my keybindings, I use this helper function:
func setkey(g *gocui.Gui, key gocui.Key, fn gocui.KeybindingHandler) { if err := g.SetKeybinding("", key, gocui.ModNone, fn); err != nil { log.Panicln(err) } }
An example invocation that works is:
setKey(g, gocui.KeyCtrlC, quit)
...but the following fails:
setKey(g, 'q', quit)
...while the following correctly binds the q key:
q
if err := g.SetKeybinding("", 'q', gocui.ModNone, quit); err != nil { log.Panicln(err) }
I'm pretty sure I'm missing something obvious here.
The text was updated successfully, but these errors were encountered:
The signature of your helper function should be:
func setkey(g *gocui.Gui, key interface{}, fn gocui.KeybindingHandler)
Because key can be a gocui.Key or a rune. Try and let me know if it works ok for you :)
Sorry, something went wrong.
Fantastic! Thank you, @jroimartin !
Merge pull request jroimartin#29 from JLevconoks/readme_fix
f92294d
Fixed readme code example
jroimartin
No branches or pull requests
When defining my keybindings, I use this helper function:
An example invocation that works is:
...but the following fails:
...while the following correctly binds the
q
key:I'm pretty sure I'm missing something obvious here.
The text was updated successfully, but these errors were encountered: