Remove 'stop' argument from lookupKey's interface
Try to factor keymap code into something that can be used externally

Issue #1076