fix stack overflow error on keypress

I found calling procedures bound to keypresses was resulting in an "uncaught stack overflow" error. This patch fixes that.

It also adds a bonus `break` to stop searching keybindings once a match is found.