generalise message loop
add event handling
add spec
emit mode change events
add ui element for active modes
display current modes
bind control to focus command line