Trait tui_prompts::State
source · pub trait State {
Show 27 methods
// Required methods
fn status(&self) -> Status;
fn status_mut(&mut self) -> &mut Status;
fn focus_state_mut(&mut self) -> &mut FocusState;
fn focus_state(&self) -> FocusState;
fn position(&self) -> usize;
fn position_mut(&mut self) -> &mut usize;
fn cursor(&self) -> (u16, u16);
fn cursor_mut(&mut self) -> &mut (u16, u16);
fn value(&self) -> &str;
fn value_mut(&mut self) -> &mut String;
// Provided methods
fn focus(&mut self) { ... }
fn blur(&mut self) { ... }
fn is_focused(&self) -> bool { ... }
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
fn handle_key_event(&mut self, key_event: KeyEvent) { ... }
fn complete(&mut self) { ... }
fn abort(&mut self) { ... }
fn delete(&mut self) { ... }
fn backspace(&mut self) { ... }
fn move_right(&mut self) { ... }
fn move_left(&mut self) { ... }
fn move_end(&mut self) { ... }
fn move_start(&mut self) { ... }
fn kill(&mut self) { ... }
fn truncate(&mut self) { ... }
fn push(&mut self, c: char) { ... }
}
Expand description
The state of a prompt.
Keybindings:
- Enter: Complete
- Esc | Ctrl+C: Abort
- Left | Ctrl+B: Move cursor left
- Right | Ctrl+F: Move cursor right
- Home | Ctrl+A: Move cursor to start of line
- End | Ctrl+E: Move cursor to end of line
- Backspace | Ctrl+H: Delete character before cursor
- Delete | Ctrl+D: Delete character after cursor
- Ctrl+K: Delete from cursor to end of line
- Ctrl+U: Delete from cursor to start of line
Required Methods§
sourcefn status_mut(&mut self) -> &mut Status
fn status_mut(&mut self) -> &mut Status
A mutable reference to the status of the prompt.
sourcefn focus_state_mut(&mut self) -> &mut FocusState
fn focus_state_mut(&mut self) -> &mut FocusState
A mutable reference to the focus state of the prompt.
sourcefn focus_state(&self) -> FocusState
fn focus_state(&self) -> FocusState
The focus state of the prompt.
sourcefn position_mut(&mut self) -> &mut usize
fn position_mut(&mut self) -> &mut usize
A mutable reference to the position of the cursor in the prompt.
sourcefn cursor_mut(&mut self) -> &mut (u16, u16)
fn cursor_mut(&mut self) -> &mut (u16, u16)
A mutable reference to the cursor position of the prompt.
Provided Methods§
sourcefn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Whether the prompt is focused.