# `adapters::bevy::vim` Notes
This module is the Bevy boundary for Vim input. It should normalize platform
input, run pure Vim semantics, and emit typed ECS messages. It should not own
authoritative buffer mutation, filesystem policy, rendering rules, or Vim
grammar inventions.
## Flow
```text
EditorInputEvent -> KeyToken/InsertCommand -> VimOperation -> VimEffectBatch -> ECS message
```
The adapter reads the focused `EditorView`, its `VimModalState`, and the
current `BufferText` stream snapshot. It then emits requests for the owner
systems in `Edit` or `Layout`.
## Module Shape
- `keyboard.rs`: converts Bevy keyboard state into editor input events and
mode-aware held-key repeat.
- `dispatch.rs`: handles normal and visual tokens, adapts pure operation
outcomes into `VimEffectBatch`, and owns dot-repeat recording at the adapter
boundary.
- `insert.rs`: handles insert-mode text, newline, Backspace, and Escape through
bounded edit plans.
- `prompts.rs`: handles command-line and search prompt input.
- `effects.rs`: owns adapter-local effect batches and drains them into typed
ECS messages.
- `system.rs`: orchestrates focused-view dispatch and contains adapter
integration tests.
## Invariants
- The adapter never mutates `TextByteStream` directly.
- `VimEffectBatch` is the adapter commit point before ECS message emission.
Authoritative mutation still occurs only in owner systems.
- Buffer edits are emitted as `BufferEditRequested`; the buffer owner still
validates stream identity, stream revision, UTF-8 boundaries, and edit
history.
- Delete and change operators carry stream-scoped validated ranges into
`BufferEdit`; those proofs are rechecked at the owner boundary.
- Cursor requests carry their coordinate kind: normal/visual cursor cell or
insert caret.
- Insert, paste, prompt, register, and rejection diagnostics must not expose
arbitrary user text.
- Dot-repeat records semantic operations, not raw input events. Replay still
resolves targets, registers, and paste plans against the current state.
- Normal text-object operators and visual text-object selection resolve through
pure `vim::text_object` target production before adapter effects are emitted.
- Visual selection cleanup happens only after an operator outcome was applied.
- Missing focused buffers are typed input rejections, not silent drops.
## Current Gaps
- Dot-repeat does not yet capture inserted text sessions. It repeats normal
delete/change operator commands and paste operations.
- Visual operator replay is deliberately not recorded because selection-shaped
targets are transient state.
- Paste and insert payload limits are static constants. User configuration can
arrive later, under host caps.