Currently each luakit window has only a single mode at any one time. This complicates many implementation details.
Motivation:
Improve handling of menu and readline bindings. They are currently explicitly bound for all modes that use the menu/input bar, which is not ideal. Goal is to separate these bindings onto input and menu modes, which are activated automatically.
Support implementing sub-modes like command::reverse-search or menu::filter without leaving parent mode.
Remove special-case all mode: change to mode that's always active.
Handle complicated mode states like command mode > reverse search > input vim binds > input normal mode
Possible solutions:
Solution 1: ordered set of modes
Each window has an ordered set of modes, each with their own bindings. Mode set order provides bind activation priority. For example, when in command mode and doing a reverse search (not yet implemented):
Currently each luakit window has only a single mode at any one time. This complicates many implementation details.
Motivation:
input
andmenu
modes, which are activated automatically.command::reverse-search
ormenu::filter
without leaving parent mode.all
mode: change to mode that's always active.Possible solutions:
Solution 1: ordered set of modes
Each window has an ordered set of modes, each with their own bindings. Mode set order provides bind activation priority. For example, when in command mode and doing a reverse search (not yet implemented):
input
andmenu
modes are added/removed on ibar/menu visibility change. These modes only have binds; noenter
orleave
functions.normal
mode. Some modes will need to listen tomode-leave
.normal
andinsert
being active at the same time?changed
hook? Called only on highest-priority mode with hook function?w:mode_enter(name)
,w:mode_leave(name)
Solution 2: stack of modes
Same as above, but modes can only be pushed/popped, not added/removed at arbitrary positions.
w:mode_leave(name)
additionally pops all modes above named mode, in reverse order.Orthogonal possibilities:
Major/minor mode split, like emacs
Modes on several objects
w
, menu, input bar widget, etc.