Skip to main content

Module buffer

Module buffer 

Source
Expand description

The keystroke buffer: a bounded, in-memory record of recently typed text in the focused element. It lets hyprcorrect answer “what was the last word?” without reading back from the focused application — which is what makes correction work in terminals.

See the “keystroke buffer” section of DESIGN.md.

Structs§

Buffer
A bounded record of recently typed text in the focused element.
NearbyWord
A word the buffer holds near (but not necessarily at) the caret, with the offset metadata needed to navigate there and replace it. Returned by Buffer::words_near_caret; the corrector uses these to recover when the buffer caret has drifted a few chars from the visible cursor (held auto-repeat, mouse click, etc.) and the picked word_at_caret turns out to be fine.
Sentence
A sentence in the buffer, located by Buffer::sentence_containing. Carries enough information for a caller holding an in-buffer byte offset (e.g. a NearbyWord’s byte_start/byte_end) to map it into sentence-relative bytes via subtraction.
SentenceAtCaret
The sentence containing (or immediately to the left of) the caret, with metadata for the emit-side replace. Returned by Buffer::sentence_at_caret.
WordAtCaret
The word at (or immediately to the left of) the caret, with the metadata an emit-side replace needs to delete the right characters before retyping. Returned by Buffer::word_at_caret.

Enums§

Key
One unit of input fed to the Buffer by the platform capture layer.