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§

source

fn status(&self) -> Status

The status of the prompt.

source

fn status_mut(&mut self) -> &mut Status

A mutable reference to the status of the prompt.

source

fn focus_state_mut(&mut self) -> &mut FocusState

A mutable reference to the focus state of the prompt.

source

fn focus_state(&self) -> FocusState

The focus state of the prompt.

source

fn position(&self) -> usize

The position of the cursor in the prompt.

source

fn position_mut(&mut self) -> &mut usize

A mutable reference to the position of the cursor in the prompt.

source

fn cursor(&self) -> (u16, u16)

The cursor position of the prompt.

source

fn cursor_mut(&mut self) -> &mut (u16, u16)

A mutable reference to the cursor position of the prompt.

source

fn value(&self) -> &str

The value of the prompt.

source

fn value_mut(&mut self) -> &mut String

A mutable reference to the value of the prompt.

Provided Methods§

source

fn focus(&mut self)

Sets the focus state of the prompt to [Focus::Focused].

source

fn blur(&mut self)

Sets the focus state of the prompt to [Focus::Unfocused].

source

fn is_focused(&self) -> bool

Whether the prompt is focused.

source

fn len(&self) -> usize

source

fn is_empty(&self) -> bool

source

fn handle_key_event(&mut self, key_event: KeyEvent)

source

fn complete(&mut self)

source

fn abort(&mut self)

source

fn delete(&mut self)

source

fn backspace(&mut self)

source

fn move_right(&mut self)

source

fn move_left(&mut self)

source

fn move_end(&mut self)

source

fn move_start(&mut self)

source

fn kill(&mut self)

source

fn truncate(&mut self)

source

fn push(&mut self, c: char)

Implementors§