Skip to main content

Module motions

Module motions 

Source
Expand description

M.2.b.3 (2026-06-01): excerpt-jump motions.

Four motions register against lattice-grammar’s CommandRegistry and bind to ]e / [e / ]E / [E in multibuffer-mode’s keymap layer:

ChordMotion idBehaviour
]emultibuffer.next-excerpt-startCursor to first row of next excerpt
[emultibuffer.prev-excerpt-startCursor to first row of prev excerpt
]Emultibuffer.next-file-boundaryCursor to next excerpt with a different source
[Emultibuffer.prev-file-boundaryCursor to prev excerpt with a different source

Handlers capture an Arc<MultibufferRegistryHandle> at registration time, look up the typed handle via ctx.buffer_id, and compute target rows from the captured excerpts. Operators (d, c, y) compose with these motions automatically — they fall out of lattice-grammar’s standard operator+motion machinery, no per-motion plumbing.

No-op behaviour: cursor stays put when there is no next / prev excerpt (e.g. cursor in the last excerpt, ]e has no target).

See docs/dev/architecture/multibuffer-views.md §3.7 + slice plan M.2.b.3.

Structs§

MultibufferMotionIds
The four motion ids registered by register_multibuffer_motions. Boot wiring threads this struct into the keymap-layer push so chord bindings reach the right motion ids.

Functions§

containing_excerpt_index
Index of the excerpt whose composed-row range contains cursor_row. None when the cursor sits above the first excerpt (only possible on empty views or row 0 with no excerpts).
excerpt_start_rows
Composed-row position of each excerpt’s first row, in display order. Equivalent to the prefix sum of excerpt.line_count().
next_excerpt_start_row
Composed row of the count-th excerpt strictly after the one containing cursor_row. None when there is no such excerpt.
next_file_boundary_row
Composed row of the count-th file-boundary excerpt forward of the boundary containing the current excerpt. A “file boundary” is the FIRST excerpt of each file group (per ]E semantics: jump to the start of the next file in the view).
prev_excerpt_start_row
Composed row of the count-th excerpt strictly before the one containing cursor_row. None when no such excerpt.
prev_file_boundary_row
Composed row of the count-th file-boundary excerpt backward of the boundary containing the current excerpt. A “file boundary” is the FIRST excerpt of each file group (per [E semantics: jump to the start of the previous file).
register_multibuffer_motions
Register the four excerpt-jump motions against registry and return their ids. Handlers capture mb_registry (cheap Arc clone) so they reach the typed view handle via ctx.buffer_id at dispatch time.