Skip to main content

Module nvim_decode

Module nvim_decode 

Source
Expand description

Pure decode of the STATE_QUERY_LUA response into a DecodedState.

This is the decode seam: every nvim wire-format fact lives here and nowhere else — the positional array shape, the byte-offset → char-index conversion, the 1-indexed → 0-indexed shift, the mode-string → EditorMode mapping, and the getpos('v') visual-mark math. The function is pure (Value in, DecodedState out) so the whole contract is testable with literal Values, without spawning a real nvim process.

Applying a DecodedState to the live Mutex<NvimSnapshot> — the in_flight gate and the content_gen/dirty bookkeeping — stays in backend.rs, because that is stateful backend bookkeeping, not decoding.

Enums§

DecodedState
One decoded STATE_QUERY_LUA response.

Functions§

decode
Decode one STATE_QUERY_LUA response. Returns None when the value is not the expected array or the leading mode element is missing — the caller leaves the snapshot untouched in that case.