Struct tty_form::step::TextBlockStep
source · pub struct TextBlockStep { /* private fields */ }Expand description
A multi-line text input step.
Examples
use tty_form::{
Form,
step::{Step, TextBlockStep},
};
let mut form = Form::new();
let mut step = TextBlockStep::new("Enter your story:");
step.set_max_line_length(100);
step.add_to(&mut form);Implementations
sourceimpl TextBlockStep
impl TextBlockStep
sourcepub fn set_margins(&mut self, top_margin: Option<u16>, bottom_margin: Option<u16>)
pub fn set_margins(&mut self, top_margin: Option<u16>, bottom_margin: Option<u16>)
Set this text block’s top and bottom margins.
sourcepub fn set_max_line_length(&mut self, max_length: u16)
pub fn set_max_line_length(&mut self, max_length: u16)
Set this text block step’s optional maximum line grapheme length.
sourcepub fn set_trim_trailing_whitespace(&mut self, trim: bool)
pub fn set_trim_trailing_whitespace(&mut self, trim: bool)
Set whether this text block should trim trailing whitespace.
Trait Implementations
sourceimpl Step for TextBlockStep
impl Step for TextBlockStep
sourcefn initialize(&mut self, _dependency_state: &mut DependencyState, _index: usize)
fn initialize(&mut self, _dependency_state: &mut DependencyState, _index: usize)
Perform any post-configuration initialization actions for this step.
sourcefn render(
&self,
interface: &mut Interface<'_>,
_dependency_state: &DependencyState,
position: Position,
is_focused: bool
) -> u16
fn render(
&self,
interface: &mut Interface<'_>,
_dependency_state: &DependencyState,
position: Position,
is_focused: bool
) -> u16
Render this step at the specified position and return the height of the rendered content.
sourcefn update(
&mut self,
_dependency_state: &mut DependencyState,
input: KeyEvent
) -> Option<InputResult>
fn update(
&mut self,
_dependency_state: &mut DependencyState,
input: KeyEvent
) -> Option<InputResult>
Handle the specified input event, optionally returning an instruction for the form.
sourcefn drawer(&self) -> Option<DrawerContents>
fn drawer(&self) -> Option<DrawerContents>
Retrieve this step’s current drawer contents, if applicable.
sourcefn result(&self, _dependency_state: &DependencyState) -> String
fn result(&self, _dependency_state: &DependencyState) -> String
Retrieves this step’s final WYSIWYG result.
Auto Trait Implementations
impl RefUnwindSafe for TextBlockStep
impl Send for TextBlockStep
impl Sync for TextBlockStep
impl Unpin for TextBlockStep
impl UnwindSafe for TextBlockStep
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more