Skip to main content

Module decline

Module decline 

Source
Expand description

AP.0.2 — the layer peel behind Effect::Declined, in one place.

A mode can bind a chord it only sometimes wants. auto-pair binds ( and <BS>; table-mode binds <Tab>. When the situation is not theirs, the action returns Effect::Declined — “I did nothing” — and the chord must be re-resolved as if that mode’s layer were not there, so it reaches whatever is underneath. A declined ( types a bracket; a declined <Tab> folds.

§Why this is a type and not a loop at each call site

It was a loop at each call site, twice, and the third caller — the GPUI peer — had neither. Every key auto-pair binds (( [ { ) ] } " ' \``, and backspace) was therefore dead in that renderer, and ` never fell through to org’s fold cycle. The TUI’s copy carried the comment “mirrors the host peel exactly (GPUI rides that path)”, which was not true and could not be checked.

What varies between callers is real: each builds its translate context from a different place and applies the resulting action through its own path (the peers have renderer-coupled intercepts the host does not). What does NOT vary is the walk — which layer to drop, what the prefix is, and when to stop — and that is what lives here. Two bugs came out of getting exactly those wrong:

  • Dropping every layer at once. active_minor_modes: &[] means a second declining layer never sees the chord, so table-mode’s <Tab> declining outside a table skipped org-mode’s fold cycle entirely and landed on the builtin jump-list. Layers compose; a chain of length two is the first case anyone writes.
  • Losing the prefix. Re-translating the final chord alone turned a declined <leader>oJ into vim’s J, which joined two lines. The peel re-resolves the SEQUENCE.

Structs§

DeclinePeel
The layer-peeling walk behind a declined chord.

Functions§

binding_mode_for
The BindingMode a modal state resolves chords in.