pub trait KeyMap {
// Required methods
fn short_help(&self) -> Vec<&Binding>;
fn full_help(&self) -> Vec<Vec<&Binding>>;
}Expand description
KeyMap trait for components that provide help information.
This trait should be implemented by any component that wants to provide contextual help information through the help component. It matches the Go implementation’s KeyMap interface.
§Examples
use bubbletea_widgets::key::{KeyMap, Binding};
use crossterm::event::KeyCode;
struct MyComponent {
save: Binding,
quit: Binding,
}
impl KeyMap for MyComponent {
fn short_help(&self) -> Vec<&Binding> {
vec![&self.save, &self.quit]
}
fn full_help(&self) -> Vec<Vec<&Binding>> {
vec![
vec![&self.save], // File operations column
vec![&self.quit], // Application column
]
}
}Required Methods§
Sourcefn short_help(&self) -> Vec<&Binding>
fn short_help(&self) -> Vec<&Binding>
Returns a slice of bindings to be displayed in the short version of help.
This should return the most important or commonly used key bindings that will fit on a single line.
Implementors§
impl KeyMap for FilepickerKeyMap
impl KeyMap for ListKeyMap
impl KeyMap for PaginatorKeyMap
impl KeyMap for TableKeyMap
impl KeyMap for TextareaKeyMap
Implementation of KeyMap trait for help integration