pub struct KeyBindingStore { /* private fields */ }Expand description
Global key table store with tmux-style default snapshots.
Implementations§
Source§impl KeyBindingStore
impl KeyBindingStore
Sourcepub fn with_defaults() -> Result<Self, CommandParseError>
pub fn with_defaults() -> Result<Self, CommandParseError>
Creates a store populated with the frozen tmux default bindings.
Sourcepub fn table(&self, name: &str) -> Option<&KeyBindingTable>
pub fn table(&self, name: &str) -> Option<&KeyBindingTable>
Returns the named table, when present.
Sourcepub fn tables(&self) -> impl Iterator<Item = &KeyBindingTable>
pub fn tables(&self) -> impl Iterator<Item = &KeyBindingTable>
Iterates every table in name order.
Sourcepub fn get_table(
&mut self,
name: &str,
create: bool,
) -> Option<KeyBindingTableRef>
pub fn get_table( &mut self, name: &str, create: bool, ) -> Option<KeyBindingTableRef>
Finds or creates a table and increments its reference count.
Sourcepub fn unref_table(&mut self, name: &str)
pub fn unref_table(&mut self, name: &str)
Drops one reference from a table and removes it if it is fully empty.
Sourcepub fn add_binding(
&mut self,
table_name: &str,
key: KeyCode,
note: Option<String>,
repeat: bool,
commands: Option<ParsedCommands>,
) -> bool
pub fn add_binding( &mut self, table_name: &str, key: KeyCode, note: Option<String>, repeat: bool, commands: Option<ParsedCommands>, ) -> bool
Adds or updates a binding in a table.
Sourcepub fn remove_binding(&mut self, table_name: &str, key: KeyCode) -> bool
pub fn remove_binding(&mut self, table_name: &str, key: KeyCode) -> bool
Removes one active binding from a table.
Sourcepub fn reset_binding(&mut self, table_name: &str, key: KeyCode)
pub fn reset_binding(&mut self, table_name: &str, key: KeyCode)
Restores one active binding from the default snapshot.
Sourcepub fn remove_table(&mut self, table_name: &str) -> bool
pub fn remove_table(&mut self, table_name: &str) -> bool
Removes every binding from a table.
Sourcepub fn reset_table(&mut self, table_name: &str)
pub fn reset_table(&mut self, table_name: &str)
Restores every binding in a table from the default snapshot.
Sourcepub fn get_binding(&self, table_name: &str, key: KeyCode) -> Option<&KeyBinding>
pub fn get_binding(&self, table_name: &str, key: KeyCode) -> Option<&KeyBinding>
Returns a binding from the active tree.
Sourcepub fn get_default_binding(
&self,
table_name: &str,
key: KeyCode,
) -> Option<&KeyBinding>
pub fn get_default_binding( &self, table_name: &str, key: KeyCode, ) -> Option<&KeyBinding>
Returns a binding from the default snapshot.
Sourcepub fn list_bindings(
&self,
table_name: Option<&str>,
sort_order: KeyBindingSortOrder,
reversed: bool,
) -> Vec<KeyBindingDisplay>
pub fn list_bindings( &self, table_name: Option<&str>, sort_order: KeyBindingSortOrder, reversed: bool, ) -> Vec<KeyBindingDisplay>
Returns every binding as display rows sorted for list-keys.
Sourcepub fn has_repeat(bindings: &[KeyBindingDisplay]) -> bool
pub fn has_repeat(bindings: &[KeyBindingDisplay]) -> bool
Returns whether any listed binding repeats.
Sourcepub fn key_string_width(bindings: &[KeyBindingDisplay]) -> usize
pub fn key_string_width(bindings: &[KeyBindingDisplay]) -> usize
Returns the maximum display width for listed key strings.
Sourcepub fn key_table_width(bindings: &[KeyBindingDisplay]) -> usize
pub fn key_table_width(bindings: &[KeyBindingDisplay]) -> usize
Returns the maximum display width for listed table names.
Trait Implementations§
Source§impl Clone for KeyBindingStore
impl Clone for KeyBindingStore
Source§fn clone(&self) -> KeyBindingStore
fn clone(&self) -> KeyBindingStore
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 KeyBindingStore
impl Debug for KeyBindingStore
Source§impl Default for KeyBindingStore
impl Default for KeyBindingStore
impl Eq for KeyBindingStore
Source§impl PartialEq for KeyBindingStore
impl PartialEq for KeyBindingStore
Source§fn eq(&self, other: &KeyBindingStore) -> bool
fn eq(&self, other: &KeyBindingStore) -> bool
self and other values to be equal, and is used by ==.