aidanholm / luakit

A fork of a fast, small, webkit based browser framework extensible by Lua that uses GTK 3 and WebKit 2.
https://aidanholm.github.io/luakit/
GNU General Public License v3.0
38 stars 8 forks source link

Refactor support for multiple modes #401

Open aidanholm opened 7 years ago

aidanholm commented 7 years ago

Currently each luakit window has only a single mode at any one time. This complicates many implementation details.

Motivation:

  1. 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.
  2. Support implementing sub-modes like command::reverse-search or menu::filter without leaving parent mode.
  3. Remove special-case all mode: change to mode that's always active.
  4. 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):

w.modes = { "all", "command", "command::reverse-search", "input", "menu" }

Solution 2: stack of modes

Same as above, but modes can only be pushed/popped, not added/removed at arbitrary positions.

Orthogonal possibilities:

Major/minor mode split, like emacs

Modes on several objects

aidanholm commented 7 years ago

Required for #378, #379.

aidanholm commented 7 years ago

Would help with #119.