Expand description
Select-mode dispatch (SN.3d.1).
Select mode (ModalState::Select(VisualKind)) is Visual’s sibling:
the same selection geometry, inverted typing semantics. A bare
printable key replaces the whole selection with that char and
drops into Insert (Action::SelectOvertype); motions that can’t be
typed extend the selection exactly as in Visual. See
docs/dev/architecture/select-mode.md.
§Why this is genuinely new dispatch, not “dispatch_visual + a flag”
crate::keymap_visual::dispatch_visual has no printable
fallthrough — an unbound printable in Visual is a no-op. The defining
Select behaviour is exactly that fallthrough: an unbound printable
overtypes. The reference for the fallthrough is
crate::keymap_insert’s literal_text_fallback (CTRL → None,
Char(c) → an edit), mapped here to the replace-and-insert edit
(select-mode.md §3) rather than a plain insert.
§Dispatch order
- Mode-control chords (fire regardless of the binding table):
<Esc>→Action::ExitSelect;<C-g>→Action::ToggleVisualSelect(toggle back to Visual, selection preserved);<C-o>→ one-shot Normal — recognised but post-MVP per select-mode.md §3, swallowed (Action::None) so a stray<C-o>never overtypes a literal char. - Mid-sequence (the prefix of a multi-key Select binding a mode
contributed, already absorbed into
partial_chord) → resolve[partial..., chord]against theBindingMode::Selecttable — the same partial-chord machinery Normal/Visual use. - Fresh chord →
BindingMode::Selectlookup.Bound→ its action (motion extends / exit);Partial→ absorb;Unbound→ the overtype fallthrough.
A bound key wins over the fallthrough, so what the Select table binds
decides what can be typed. The table holds only keys that can’t be:
the keymap’s motion mirror (VM.4) admits a motion only when its first
chord wouldn’t overtype, using lattice_keymap::overtypes_in_select,
the same predicate the fallthrough calls. Nothing else binds a bare
printable here (VM.5): vim’s Select has no swap-ends o and no text
objects either, because those keys are typed text. <C-g> flips to
Visual for both.
Functions§
- translate_
select - Dispatch a Select-mode key event. See the module docs for the
ordering contract.
partial_chordis the host’s running multi-key prefix (empty on a fresh chord; holds an absorbed prefix mid-sequence), identical to the Visual path.