pub struct KeyBindings {Show 18 fields
pub move_up: Vec<KeyCombo>,
pub move_down: Vec<KeyCombo>,
pub move_left: Vec<KeyCombo>,
pub move_right: Vec<KeyCombo>,
pub move_line_start: Vec<KeyCombo>,
pub move_line_end: Vec<KeyCombo>,
pub delete_char_before: Vec<KeyCombo>,
pub delete_char_at: Vec<KeyCombo>,
pub kill_line: Vec<KeyCombo>,
pub insert_newline: Vec<KeyCombo>,
pub submit: Vec<KeyCombo>,
pub interrupt: Vec<KeyCombo>,
pub quit: Vec<KeyCombo>,
pub force_quit: Vec<KeyCombo>,
pub enter_exit_mode: Vec<KeyCombo>,
pub exit_timeout_secs: u64,
pub select: Vec<KeyCombo>,
pub cancel: Vec<KeyCombo>,
}Expand description
Fields§
§move_up: Vec<KeyCombo>Move cursor up.
move_down: Vec<KeyCombo>Move cursor down.
move_left: Vec<KeyCombo>Move cursor left.
move_right: Vec<KeyCombo>Move cursor right.
move_line_start: Vec<KeyCombo>Move to line start.
move_line_end: Vec<KeyCombo>Move to line end.
delete_char_before: Vec<KeyCombo>Delete char before cursor.
delete_char_at: Vec<KeyCombo>Delete char at cursor.
kill_line: Vec<KeyCombo>Kill to end of line.
insert_newline: Vec<KeyCombo>Insert newline in multi-line input.
submit: Vec<KeyCombo>Submit message.
interrupt: Vec<KeyCombo>Interrupt current request.
quit: Vec<KeyCombo>Quit immediately (only when input empty and no modal is blocking).
force_quit: Vec<KeyCombo>Force quit (works even in modals).
enter_exit_mode: Vec<KeyCombo>Enter exit confirmation mode (requires pressing twice to exit).
exit_timeout_secs: u64Timeout in seconds for exit confirmation mode.
select: Vec<KeyCombo>Select/confirm in widgets (Enter, Space).
cancel: Vec<KeyCombo>Cancel/close in widgets (Esc).
Implementations§
Source§impl KeyBindings
impl KeyBindings
Sourcepub fn emacs() -> KeyBindings
pub fn emacs() -> KeyBindings
Emacs-style bindings.
Full-featured bindings for power users:
- Ctrl+P/N/B/F for navigation
- Ctrl+A/E for line start/end
- Ctrl+K to kill line
- Ctrl+D for exit mode (or delete char if not empty)
- Esc to interrupt
Sourcepub fn minimal() -> KeyBindings
pub fn minimal() -> KeyBindings
Minimal bindings (arrows only, Esc to quit).
This is simpler for users unfamiliar with Emacs:
- Arrow keys only for navigation
- Esc quits (when input empty and no modal)
- No Ctrl key requirements for basic use
Sourcepub fn with_move_up(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_move_up(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the move up key bindings.
Sourcepub fn with_move_down(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_move_down(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the move down key bindings.
Sourcepub fn with_move_left(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_move_left(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the move left key bindings.
Sourcepub fn with_move_right(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_move_right(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the move right key bindings.
Sourcepub fn with_move_line_start(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_move_line_start(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the move to line start key bindings.
Sourcepub fn with_move_line_end(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_move_line_end(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the move to line end key bindings.
Sourcepub fn with_delete_char_before(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_delete_char_before(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the delete char before (backspace) key bindings.
Sourcepub fn with_delete_char_at(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_delete_char_at(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the delete char at (delete) key bindings.
Sourcepub fn with_kill_line(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_kill_line(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the kill line key bindings.
Sourcepub fn with_insert_newline(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_insert_newline(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the insert newline key bindings.
Sourcepub fn with_submit(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_submit(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the submit key bindings.
Sourcepub fn with_interrupt(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_interrupt(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the interrupt key bindings.
Sourcepub fn with_quit(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_quit(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the quit key bindings.
Sourcepub fn with_force_quit(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_force_quit(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the force quit key bindings.
Sourcepub fn with_enter_exit_mode(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_enter_exit_mode(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the enter exit mode key bindings.
Sourcepub fn with_exit_timeout_secs(self, secs: u64) -> KeyBindings
pub fn with_exit_timeout_secs(self, secs: u64) -> KeyBindings
Set the exit timeout in seconds.
Sourcepub fn with_select(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_select(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the select key bindings (for widget selection).
Sourcepub fn with_cancel(self, combos: Vec<KeyCombo>) -> KeyBindings
pub fn with_cancel(self, combos: Vec<KeyCombo>) -> KeyBindings
Set the cancel key bindings (for widget cancellation).
Sourcepub fn without_exit_mode(self) -> KeyBindings
pub fn without_exit_mode(self) -> KeyBindings
Disable exit mode (sets enter_exit_mode to empty).
Sourcepub fn without_quit(self) -> KeyBindings
pub fn without_quit(self) -> KeyBindings
Disable quit binding (sets quit to empty).
Sourcepub fn without_force_quit(self) -> KeyBindings
pub fn without_force_quit(self) -> KeyBindings
Disable force quit binding (sets force_quit to empty).
Sourcepub fn without_interrupt(self) -> KeyBindings
pub fn without_interrupt(self) -> KeyBindings
Disable interrupt binding (sets interrupt to empty).
Sourcepub fn without_kill_line(self) -> KeyBindings
pub fn without_kill_line(self) -> KeyBindings
Disable kill line binding (sets kill_line to empty).
Sourcepub fn without_insert_newline(self) -> KeyBindings
pub fn without_insert_newline(self) -> KeyBindings
Disable insert newline binding (sets insert_newline to empty).
Sourcepub fn add_move_up(self, combo: KeyCombo) -> KeyBindings
pub fn add_move_up(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the move up bindings.
Sourcepub fn add_move_down(self, combo: KeyCombo) -> KeyBindings
pub fn add_move_down(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the move down bindings.
Sourcepub fn add_move_left(self, combo: KeyCombo) -> KeyBindings
pub fn add_move_left(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the move left bindings.
Sourcepub fn add_move_right(self, combo: KeyCombo) -> KeyBindings
pub fn add_move_right(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the move right bindings.
Sourcepub fn add_quit(self, combo: KeyCombo) -> KeyBindings
pub fn add_quit(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the quit bindings.
Sourcepub fn add_submit(self, combo: KeyCombo) -> KeyBindings
pub fn add_submit(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the submit bindings.
Sourcepub fn add_interrupt(self, combo: KeyCombo) -> KeyBindings
pub fn add_interrupt(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the interrupt bindings.
Sourcepub fn add_enter_exit_mode(self, combo: KeyCombo) -> KeyBindings
pub fn add_enter_exit_mode(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the enter exit mode bindings.
Sourcepub fn add_force_quit(self, combo: KeyCombo) -> KeyBindings
pub fn add_force_quit(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the force quit bindings.
Sourcepub fn add_select(self, combo: KeyCombo) -> KeyBindings
pub fn add_select(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the select bindings.
Sourcepub fn add_cancel(self, combo: KeyCombo) -> KeyBindings
pub fn add_cancel(self, combo: KeyCombo) -> KeyBindings
Add a key combo to the cancel bindings.
Trait Implementations§
Source§impl Clone for KeyBindings
impl Clone for KeyBindings
Source§fn clone(&self) -> KeyBindings
fn clone(&self) -> KeyBindings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KeyBindings
impl Debug for KeyBindings
Source§impl Default for KeyBindings
impl Default for KeyBindings
Source§fn default() -> KeyBindings
fn default() -> KeyBindings
Auto Trait Implementations§
impl Freeze for KeyBindings
impl RefUnwindSafe for KeyBindings
impl Send for KeyBindings
impl Sync for KeyBindings
impl Unpin for KeyBindings
impl UnwindSafe for KeyBindings
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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