-
Notifications
You must be signed in to change notification settings - Fork 2
Key Processing
SubText tries to process keys in an Emacs-inspired fashion.
Most importantly, keys are bound by context classes. This gives presentations full control over keyboard input and mouse clicks (which are presented as keys). The controlling view catches keys and mouseclicks, and dispatches it into the context hierarchy, handling search logic and immediate bindings such as C-g.
Currently, GTK keys are assembled along with their modifiers into a key sequence. The sequence is then searched in keymaps of all contexts bisected by the cursor, starting with the innermost one out to the most general one, and eventually, the eli last-resort keymap. The result decides the action to take:
search | action |
---|---|
found | execute binding |
partial match | wait for next key and search again |
no match | if a single key, let GTK handle it. If at the end of a keyseq, cancel |
The keymap here is a list of (keyseq . action) pairs. The search is extremely dynamic.