pub struct Keymap { /* private fields */ }Implementations§
Source§impl Keymap
impl Keymap
Sourcepub fn defaults() -> Self
pub fn defaults() -> Self
Built-in defaults. Mirrors the historical hard-coded set in
src/tui/mod.rs before issue #87. Adding a default binding
here automatically surfaces it in gwm tui keys and the help
overlay.
Sourcepub fn apply_override(
&mut self,
action: Action,
chords: Vec<Vec<KeyStroke>>,
) -> Result<()>
pub fn apply_override( &mut self, action: Action, chords: Vec<Vec<KeyStroke>>, ) -> Result<()>
Replace the chords bound to action with chords and re-validate
the full keymap. An empty Vec unbinds the action. The validation
pass rejects:
- the same chord wired to two different actions (conflict);
- a chord that is a strict prefix of another (
gwhileg gis bound) — see the module-level chord/prefix policy note.
Returns Err(GwmError::Config(_)) on failure; the keymap is
left untouched on error so callers can surface the message and
move on.
Sourcepub fn lookup(&self, keys: &[KeyStroke]) -> ChordResolution
pub fn lookup(&self, keys: &[KeyStroke]) -> ChordResolution
Resolve a pending-keys buffer against the keymap.
Sourcepub fn list(&self) -> Vec<Binding>
pub fn list(&self) -> Vec<Binding>
Snapshot the resolved keymap for gwm tui keys / help overlay.
Order matches the declarative define_actions! invocation so the
rendered table stays stable across runs.
Sourcepub fn primary_chord(&self, action: Action) -> Option<String>
pub fn primary_chord(&self, action: Action) -> Option<String>
The canonical rendering of the first chord bound to action,
or None when the action is unbound. Used by UI copy that names a
key inline (e.g. pane titles such as Issue / PR [F],
issue #224) so the hint tracks user overrides under [tui.keys]
instead of hard-coding a default that may have been rebound. A
multi-chord action returns its first chord in declaration order,
matching what gwm tui keys lists first.
Sourcepub fn keys_display(&self, action: Action) -> String
pub fn keys_display(&self, action: Action) -> String
Every chord bound to action, comma-joined ("j, Down") or empty when
unbound — the help-overlay / Keys-tab row form. Mirrors
crate::tui::modal_keymap::ModalKeymap::keys_display.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Keymap
impl RefUnwindSafe for Keymap
impl Send for Keymap
impl Sync for Keymap
impl Unpin for Keymap
impl UnsafeUnpin for Keymap
impl UnwindSafe for Keymap
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