pub struct TranslateContext<'a> {Show 19 fields
pub modal: ModalState,
pub builtins: &'a Builtins,
pub pending_count: u32,
pub op_count: u32,
pub recording_macro: bool,
pub active_buffer: BufferKind,
pub completion_open: bool,
pub chord_capture: bool,
pub picker_open: bool,
pub insert_completion_open: bool,
pub snippet_active: bool,
pub terminal_insert_active: bool,
pub terminal_esc_exits: bool,
pub terminal_app_cursor_keys: bool,
pub terminal_insert_exit_pending: bool,
pub terminal_visual_active: bool,
pub keymap: &'a KeymapHandle,
pub partial_chord: &'a [KeyChord],
pub active_minor_modes: &'a [ModeId],
}Fields§
§modal: ModalState§builtins: &'a Builtins§pending_count: u32In-progress count prefix; 0 means none. Translate uses this to
disambiguate the 0 key (line_start when no count in progress;
digit-zero appended to count otherwise).
op_count: u32Operator-side count latched at Pending::AfterOperator
activation (App moves pending_count -> op_count then
resets pending_count so the in-progress digits track
the motion side of <op-count><op><motion-count><motion>).
Slice 8.g.iv reads this in keymap_normal::attach_count
to multiply with the motion count when an
Action::Invoke resolves.
recording_macro: boolTrue when a macro is currently being recorded. Translate uses
this so q while recording stops, while q otherwise starts a
new recording.
active_buffer: BufferKindWhich buffer the App’s input pipeline currently routes to.
Driven by [crate::app::App::active_buffer]; defaults to
BufferKind::Document. Help buffers route through the
same Normal-mode chord grammar (motions, <C-o> / <C-i>,
gg / G, etc.) – only three buffer-local bindings
differ: Esc / q dismiss the help overlay, and <CR>
follows the link under the cursor.
completion_open: boolTrue when the command-line completion popup is open (DESIGN.md §5.11.3). Tab / S-Tab / Enter / Esc are claimed by the popup before falling through to Command mode.
chord_capture: boolTrue when the cmdline cursor sits on an ArgKind::Chord
arg slot. In this mode every key event renders to a chord
token and gets appended — no key is reserved, so <CR>,
<Esc> and <BS> describe themselves rather than acting as
submit / cancel / delete (DK.2). Multi-stroke sequences
(gg, <C-w>j) work by pressing each chord in turn; the
keymap trie decides when the sequence is finished, so there
is no terminator to press.
picker_open: boolTrue when a picker (Picker overlay) is open. Picker
claims every key before the modal handlers see it: char
keys append to the query, <Up> / <C-p> / <Down> /
<C-n> move selection, <CR> accepts, <Esc> dismisses.
insert_completion_open: boolTrue when the Insert-mode completion popup is open
(Phase 4.2.g.1). Activates the completion-popup minor
mode: <C-n> / <C-p> navigate, <C-y> / <Tab> /
<CR> accept, <C-e> cancels, <Esc> cancels and
exits Insert. Bindings inside this layer override the
usual Insert-mode + Normal-mode meanings (notably
<C-d> becomes “toggle docs popup” instead of
“shift-left-indent” / “half-page-down”). Closing the
popup deactivates the layer; original bindings restore.
snippet_active: boolTrue when an ActiveSnippet is in flight (Phase
4.2.g.4). Activates the active-snippet minor mode:
<Tab> jumps to the next placeholder, <S-Tab> to
the previous, <Esc> exits the snippet (and Insert).
The layer claims <Tab> ahead of Insert-mode’s
“insert literal tab” so placeholder navigation is
stable; closing the snippet deactivates the layer.
terminal_insert_active: boolTerminal-mode T2.a (2026-05-25): true when
terminal-insert-mode is active on the active Terminal
buffer. translate short-circuits early in this state:
keystrokes encode to ANSI bytes (via
keymap_terminal::key_to_ansi) and emit
Action::TerminalInput instead of going through the
modal-state dispatchers.
terminal_esc_exits: boolTerminal-mode T2.b.0 (2026-05-25): resolved value of the
terminal.esc-exits typed option for the active pane’s
buffer. When true and terminal_insert_active is also
true, <Esc> emits Action::ExitTerminalInsert instead
of encoding to \x1b for the PTY. Users running nested
vim / htop inside the terminal flip the option off and
use <C-\><C-n> (T2.c) to exit.
terminal_app_cursor_keys: boolTerminal-mode T2.c (2026-05-25): DECCKM mode bit
(application-cursor-keys) from the active terminal’s
alacritty Term. Threaded into
keymap_terminal::key_to_ansi_with_mode so arrow keys
encode as SS3 (ESC O A) vs CSI (ESC [ A).
terminal_insert_exit_pending: boolTerminal-mode T2.c (2026-05-25): <C-\> exit chord is
armed and waiting for the confirm key. When set, the
translate layer routes the next keystroke into the
chord-resolution branch instead of the normal encoder.
terminal_visual_active: bool2026-05-25: true when the active Terminal buffer holds
an in-flight Visual selection (t.visual.is_some()).
Terminal-Visual lives on the buffer (modal stays Normal)
so the <Esc> / v exit chords don’t come through
keymap_visual’s ExitVisual bindings; this layer
short-circuits them when the flag is set.
keymap: &'a KeymapHandleLayered keymap registry (DESIGN.md §5.2.3, audit
slice 8.c – 8.d). translate consults this instead
of the per-mode hand-rolled match tables one slice
at a time as the migration progresses; Replace mode
is the first migrated dispatcher. Borrowed for the
duration of the translate call – a single
ArcSwap::load happens inside the dispatcher.
partial_chord: &'a [KeyChord]Slice 8.i.4.a: in-flight partial-chord stack from
App::partial_chord. When non-empty, translate_normal
runs the keymap lookup with this as the prefix instead
of the legacy match pending body; the simple
prefix-only Pending variants (AfterG / AfterZ /
AfterCtrlW / AfterSetMark / AfterJumpMarkLine /
AfterJumpMarkExact / AfterRegister / AfterMacroStart /
AfterMacroPlay) all funnel through here now.
active_minor_modes: &'a [ModeId]D.5.b (2026-05-30): active buffer’s minor modes, in
activation order. Threaded into lookup_with_context so
chord bindings registered under MinorMode(ModeId)
layers only fire on buffers where the corresponding
mode is in ActiveModes.minors(). Empty slice means
“no minor modes active” — minor-mode bindings are
invisible to dispatch under that constraint
(K.1.c fast path). Normal-mode dispatch uses this
today (lookup_normal / lookup_normal_with_prefix);
Visual / Insert / Replace stay on the legacy
all-registered-modes-active lookup until D.5
extends their grammar.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for TranslateContext<'a>
impl<'a> !UnwindSafe for TranslateContext<'a>
impl<'a> Freeze for TranslateContext<'a>
impl<'a> Send for TranslateContext<'a>
impl<'a> Sync for TranslateContext<'a>
impl<'a> Unpin for TranslateContext<'a>
impl<'a> UnsafeUnpin for TranslateContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more