Closed Kugelschieber closed 5 years ago
I had a similar problem, and seem to have got what I needed via setting the handler func to be empty:
func deregisterEventHandlers() {
ui.Handle("/sys/kbd/", func(ev ui.Event) {})
ui.Handle("/sys/kbd/C-c", func(ev ui.Event) {})
ui.Handle("/sys/wnd/resize", func(ev ui.Event) {})
}
If you're shelling out, you will also need to enable echo and opost (at least) on the tty:
stty := exec.Command("stty", "-f", "/dev/tty", "echo", "opost")
_ = stty.Run()
(& re-enable and re-render afterwards)
I'm still not 100% this is the 'right' way, but can't see another way of doing it without a PR onto nsf/termbox-go
I solved it by adding a function to remove handlers to termui directly. But I wanted to know if there is a "right" way of doing it already. I may create a pull request, but the author doesn't seem to do much for a month.
Closing this as events have been reworked so there is no longer any event handlers, but let me know if you still have any issues.
Is it possible to remove event handlers? I can't find a way to remove them.