pub struct ModalKeymap { /* private fields */ }Expand description
The resolved contextual keymap: every modal verb with its keys. Built
from ModalKeymap::defaults then layered with user overrides via
ModalKeymap::apply_override.
Implementations§
Source§impl ModalKeymap
impl ModalKeymap
Sourcepub fn defaults() -> Self
pub fn defaults() -> Self
Built-in defaults — mirror the historical hard-coded modal routing in
src/tui/mod.rs before issue #219.
Sourcepub fn apply_override(
&mut self,
action: ModalAction,
keys: Vec<KeyStroke>,
) -> Result<()>
pub fn apply_override( &mut self, action: ModalAction, keys: Vec<KeyStroke>, ) -> Result<()>
Replace the keys bound to action with keys and re-validate the
action’s context. An empty Vec unbinds the verb.
Validation rejects the same stroke wired to two different verbs in the same context (cross-context reuse is fine — that is the whole point). A default binding in the same context silently vacates any stroke the override claims, mirroring the global keymap: explicit user intent wins over a shipped default.
Sourcepub fn resolve(
&self,
ctx: KeyContext,
stroke: &KeyStroke,
) -> Option<ModalAction>
pub fn resolve( &self, ctx: KeyContext, stroke: &KeyStroke, ) -> Option<ModalAction>
Resolve a single keystroke against the bindings of ctx. Returns the
matched verb, or None when nothing in this context binds the stroke
(the caller then applies the context’s text-input / default fallback).
Sourcepub fn bindings_for(&self, ctx: KeyContext) -> Vec<&ModalBinding>
pub fn bindings_for(&self, ctx: KeyContext) -> Vec<&ModalBinding>
Every binding whose verb lives in ctx, in declaration order.
Sourcepub fn list(&self) -> &[ModalBinding]
pub fn list(&self) -> &[ModalBinding]
Snapshot of every binding, declaration order, for gwm tui keys /
the help overlay / gwm doctor.
Sourcepub fn primary_key(&self, action: ModalAction) -> Option<String>
pub fn primary_key(&self, action: ModalAction) -> Option<String>
The first key bound to action, rendered for an inline hint (the
statusbar chip / help-overlay footer). None when the verb is
unbound — the caller drops it rather than advertise a phantom key.
Mirrors crate::tui::keymap::Keymap::primary_chord.
Sourcepub fn keys_display(&self, action: ModalAction) -> String
pub fn keys_display(&self, action: ModalAction) -> String
Every key bound to action, comma-joined ("n, Esc") or empty when
unbound — the help-overlay row form, matching the global keymap’s
keys_for rendering.
Trait Implementations§
Source§impl Clone for ModalKeymap
impl Clone for ModalKeymap
Source§fn clone(&self) -> ModalKeymap
fn clone(&self) -> ModalKeymap
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModalKeymap
impl Debug for ModalKeymap
Auto Trait Implementations§
impl Freeze for ModalKeymap
impl RefUnwindSafe for ModalKeymap
impl Send for ModalKeymap
impl Sync for ModalKeymap
impl Unpin for ModalKeymap
impl UnsafeUnpin for ModalKeymap
impl UnwindSafe for ModalKeymap
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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