Support exitInsertMode for keys handled by keypress