Add *Gui.DeleteKeybindings

*Gui.DeleteKeybindings Deletes all keybindings of view
This commit is contained in:
govlas 2016-09-30 17:39:02 +03:00 committed by Roi Martin
parent 30f7d65597
commit f1f9c0fa53

12
gui.go
View File

@ -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) {