pub struct Help { /* private fields */ }Expand description
A searchable help overlay (#473): every binding of a keymap, grouped by context, with its keys and what it does. Typing searches keys, descriptions and contexts; the arrows and PageUp/PageDown scroll; Escape clears the search, then closes; Enter closes.
Options: wrap wraps a row too long for the width (its
keys and its description) rather than cutting it,
key_format says the keys another way (<C-u>),
flat lists every binding in one list under the search
line and a rule, with no context headings, and
filter_key makes letters move until a key starts
the search (Yazi’s /).
Implementations§
Source§impl Help
impl Help
pub fn from_bindings(bindings: impl IntoIterator<Item = Binding>) -> Help
Sourcepub fn filter_key(self, key: Option<Key>) -> Self
pub fn filter_key(self, key: Option<Key>) -> Self
Move with the letters until key is pressed, and only then search:
j/k move a row, g and G go to the top and the bottom, and
key (Yazi’s /) starts the search, which Escape ends (clearing
it). None, the default, searches as soon as a letter is typed.
pub fn prompt(self, prompt: impl Into<String>) -> Self
pub fn theme(self, theme: Theme) -> Self
Sourcepub fn wrap(self, on: bool) -> Self
pub fn wrap(self, on: bool) -> Self
Wrap a row too long for the width onto the next rows, under its description, rather than cut it. Off by default.
Sourcepub fn flat(self, on: bool) -> Self
pub fn flat(self, on: bool) -> Self
Every binding in one list, under the search line and a rule, with no heading for each context (Yazi’s help). Off by default.
Sourcepub fn key_format(self, format: impl Fn(&Binding) -> String + 'static) -> Self
pub fn key_format(self, format: impl Fn(&Binding) -> String + 'static) -> Self
Say each binding’s keys with format (vim’s <C-u>, say) rather
than as Binding::hint does; searching finds them as said.
Sourcepub fn set_bindings(&mut self, bindings: impl IntoIterator<Item = Binding>)
pub fn set_bindings(&mut self, bindings: impl IntoIterator<Item = Binding>)
Put bindings in place of those it has, as they change while it is
open: the search stays, and so does the scroll, as far as the new
rows reach.
Trait Implementations§
Source§impl Component for Help
impl Component for Help
type Output = ()
Source§fn handle(&mut self, event: &Event, _: &Context<'_>) -> Flow<()>
fn handle(&mut self, event: &Event, _: &Context<'_>) -> Flow<()>
Outcome::Interrupted.Source§fn mouse(&self) -> bool
fn mouse(&self) -> bool
run then enables mouse reporting
for the session.Source§fn keymap(&self) -> Keymap
fn keymap(&self) -> Keymap
keymap). A container’s include its focused
child’s, before its own. The default declares none.Source§fn start(&mut self, context: &Context<'_>) -> Flow<Self::Output>
fn start(&mut self, context: &Context<'_>) -> Flow<Self::Output>
Done or Cancel finishes the component
without waiting for an event. The default does nothing.Source§fn tick(&self) -> Option<Duration>
fn tick(&self) -> Option<Duration>
Event::Tick, for a spinner or a
countdown. None (the default): never.Source§fn focusable(&self) -> bool
fn focusable(&self) -> bool
Source§fn focus_step(&mut self, forward: bool) -> bool
fn focus_step(&mut self, forward: bool) -> bool
forward) or previous focus stop inside
this component, for Tab and Shift+Tab. false when there is none
after the current one, so the container moves on to its next
child. The default, for a component that is one stop: false.Source§fn focus_enter(&mut self, forward: bool) -> bool
fn focus_enter(&mut self, forward: bool) -> bool
forward,
at the last otherwise. false when nothing in it can take focus.
The default: whether the component is focusable.Source§fn default_value(&self) -> Option<Self::Output>
fn default_value(&self) -> Option<Self::Output>
None: there is none.Auto Trait Implementations§
impl !Freeze for Help
impl !RefUnwindSafe for Help
impl !Send for Help
impl !Sync for Help
impl !UnwindSafe for Help
impl Unpin for Help
impl UnsafeUnpin for Help
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<C> ComponentExt for Cwhere
C: Component,
impl<C> ComponentExt for Cwhere
C: Component,
Source§fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
fn map<'a, M>(
self,
done: impl FnMut(Self::Output) -> Flow<M> + 'a,
) -> Map<'a, Self, M>where
Self: 'a,
M’s flow: Flow::Done(m) to
finish the whole composition with m, Flow::Continue to carry on
(the component stays, showing its answer, and focus moves past it).
Cancelling cancels the composition unless
on_cancel says otherwise.