mirror of
https://github.com/jroimartin/gocui.git
synced 2025-04-24 13:48:51 +08:00
Add *Gui.DeleteKeybindings
*Gui.DeleteKeybindings Deletes all keybindings of view
This commit is contained in:
parent
30f7d65597
commit
f1f9c0fa53
12
gui.go
12
gui.go
@ -246,6 +246,18 @@ func (g *Gui) DeleteKeybinding(viewname string, key interface{}, mod Modifier) e
|
||||
return errors.New("keybinding not found")
|
||||
}
|
||||
|
||||
// DeleteKeybindings deletes all keybindings of view
|
||||
func (g *Gui) DeleteKeybindings(viewname string) {
|
||||
|
||||
var res []*keybinding
|
||||
for _, kb := range g.keybindings {
|
||||
if kb.viewName != viewname {
|
||||
res = append(res, kb)
|
||||
}
|
||||
}
|
||||
g.keybindings = res
|
||||
}
|
||||
|
||||
// getKey takes an empty interface with a key and returns the corresponding
|
||||
// typed Key or rune.
|
||||
func getKey(key interface{}) (Key, rune, error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user