Closed dcu closed 8 years ago
Keybindings are assigned at Gui level, not at View level. So, I feel that deleting a View should not affect keybindings. What about adding a new function like the next one?
func (g *Gui) DeleteKeybinding(viewname string, key interface{}, mod Modifier) error
What's the purpose of a key binding on a view that should no longer exist? I think it's confusing and hard to debug.
On Sat, Oct 3, 2015, 5:14 AM Roi Martin notifications@github.com wrote:
Keybindings are assigned at Gui level, not at View level. So, I feel that deleting a View should not affect to keybindings. What about adding a new function like the next one?
func (g *Gui) DeleteKeybinding(viewname string, key interface{}, mod Modifier) error
— Reply to this email directly or view it on GitHub https://github.com/jroimartin/gocui/issues/32#issuecomment-145234582.
Sorry for my really really late response. I've been very busy with other projects.
One case could be, for instance, this one: https://github.com/jroimartin/gocui/blob/master/_examples/demo.go#L105
You can set-up keybindings for all the views you know you will show, so it is not needed to reassign them each time you add/delete the views. One case where this is useful is, for example, dialogs. Also you can group all the keybinding settings in one place and execute them only once.
Closed due to inactivity. Feel free to reopen if you want to continue the discussion.
Looks like I'm a little late to the party, but I would love to see the ability to delete keybindings implemented. I'm currently working on a project, and I found myself needing to create six views that are almost entirely identical because I need to set different keybindings on each of them. None of the views should ever be active at the same time, so being able to re-use that view with different keybindings would really simplify the code.
Hi @leerumler,
I've just added *Gui.DeleteKeybinding in 2a0623774fea2f2326126a71f1099a0a395e004c. Is it enough? :)
Sorry for the late response on this, but yeah, that will work perfectly! Thank you!
It seems like delete view is not removing the associated key bindings and it causes issues on dynamic UIs.