pub struct Input { /* private fields */ }Expand description
Single-line text input with horizontal scrolling.
Defaults to Emacs-style bindings (Ctrl+A, Ctrl+E, Ctrl+K, etc.).
Call set_vim_mode_enabled to opt into
vim-style modal editing (Normal/Insert mode with hl, x, i, etc.).
The input scrolls horizontally when the text exceeds the render width so that the cursor always remains visible. Supports undo, yank, and kill-ring.
Implementations§
Source§impl Input
impl Input
Sourcepub fn vim_mode_enabled(&self) -> bool
pub fn vim_mode_enabled(&self) -> bool
Returns true if vim modal editing is enabled.
Sourcepub fn set_vim_mode_enabled(&mut self, enabled: bool)
pub fn set_vim_mode_enabled(&mut self, enabled: bool)
Enable or disable vim modal editing.
When enabled the input starts in Normal mode; press i to insert,
Escape to return to Normal. When disabled, Emacs-style bindings
are always active.
Sourcepub fn mode(&self) -> InputVimMode
pub fn mode(&self) -> InputVimMode
Current vim mode (only meaningful when vim mode is enabled).
Sourcepub fn set_mode(&mut self, mode: InputVimMode)
pub fn set_mode(&mut self, mode: InputVimMode)
Switch to the given vim mode.
Trait Implementations§
Source§impl Component for Input
impl Component for Input
Source§fn render(&self, width: u16) -> Result<Rendered, RenderError>
fn render(&self, width: u16) -> Result<Rendered, RenderError>
Render this component into lines of text at the given width. Read more
Source§fn handle_input(&mut self, event: &Event) -> InputResult
fn handle_input(&mut self, event: &Event) -> InputResult
Handle an input event (key press, resize, mouse, etc.). Read more
Source§fn as_focusable(&self) -> Option<&dyn Focusable>
fn as_focusable(&self) -> Option<&dyn Focusable>
Cast this component to a
Focusable reference, if supported.Source§fn as_focusable_mut(&mut self) -> Option<&mut dyn Focusable>
fn as_focusable_mut(&mut self) -> Option<&mut dyn Focusable>
Cast this component to a mutable
Focusable reference, if supported.Source§fn render_rect(&self, rect: Rect) -> Result<Rendered, RenderError>
fn render_rect(&self, rect: Rect) -> Result<Rendered, RenderError>
Render this component into a specific rectangular area. Read more
Source§fn wants_key_release(&self) -> bool
fn wants_key_release(&self) -> bool
Returns
true if this component wants to receive
KeyEventKind::Release events in addition to Press / Repeat. Read moreAuto Trait Implementations§
impl !Freeze for Input
impl !RefUnwindSafe for Input
impl !Sync for Input
impl Send for Input
impl Unpin for Input
impl UnsafeUnpin for Input
impl UnwindSafe for Input
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
Mutably borrows from an owned value. Read more