tulir / gomuks

A terminal based Matrix client written in Go.
https://maunium.net/go/gomuks
GNU Affero General Public License v3.0
1.34k stars 120 forks source link

Mispelling `Ctrl+<other>` key binding causes crash; maybe just report on console? #420

Open goodboy opened 1 year ago

goodboy commented 1 year ago

I misspelled Ctrl when mucking with custom kbs..

visual:
  'Ctl+Space': select_prev

Causes following stack trace (as dumped to /tmp/):

failed to parse keybinding Ctl+Space -> select_prev: invalid key event
goroutine 1 [running]:
runtime/debug.Stack()
    /usr/lib/go/src/runtime/debug/stack.go:24 +0x65
maunium.net/go/gomuks/debug.PrettyPanic({0xfa59a0, 0xc00042df80})
    /home/goodboy/repos/gomuks/debug/debug.go:133 +0x19a
maunium.net/go/gomuks/debug.Recover()
    /home/goodboy/repos/gomuks/debug/debug.go:107 +0x5a
panic({0xfa59a0, 0xc00042df80})
    /usr/lib/go/src/runtime/panic.go:884 +0x213
maunium.net/go/gomuks/config.parseKeybindings(0xc000473e30)
    /home/goodboy/repos/gomuks/config/config.go:252 +0x215
maunium.net/go/gomuks/config.(*Config).LoadKeybindings(0xc0001578c0)
    /home/goodboy/repos/gomuks/config/config.go:280 +0x15e
maunium.net/go/gomuks/config.(*Config).LoadAll(0xc0001578c0)
    /home/goodboy/repos/gomuks/config/config.go:203 +0x252
main.NewGomuks(0x114fe78, {0xc00002f7e0, 0x1c}, {0xc00002ca20, 0x21}, {0xc00002f820, 0x1b}, {0xc00002ab10, 0x17})
    /home/goodboy/repos/gomuks/gomuks.go:88 +0x191
main.main()
    /home/goodboy/repos/gomuks/main.go:106 +0x65e

Feels like this could be better if just reported to console so a user doesn't have to dig through a stack trace?