pub struct TextBoxState<I: ApplicationInfo = EmptyInfo> { /* private fields */ }Expand description
Persistent state for TextBox.
Implementations§
Source§impl<I> TextBoxState<I>where
I: ApplicationInfo,
impl<I> TextBoxState<I>where
I: ApplicationInfo,
Sourcepub fn new(buffer: SharedBuffer<I>) -> Self
pub fn new(buffer: SharedBuffer<I>) -> Self
Create state for a new text box.
Sourcepub fn buffer(&self) -> SharedBuffer<I>
pub fn buffer(&self) -> SharedBuffer<I>
Get a reference to the shared buffer used by this text box.
Sourcepub fn is_readonly(&self) -> bool
pub fn is_readonly(&self) -> bool
Indicates whether the buffer contents are readonly.
Sourcepub fn set_readonly(&mut self, readonly: bool)
pub fn set_readonly(&mut self, readonly: bool)
Set whether the buffer contents are modifiable through the Editable trait.
Sourcepub fn set_text<T: Into<EditRope>>(&mut self, t: T)
pub fn set_text<T: Into<EditRope>>(&mut self, t: T)
Replace the contents of the text box’s underlying buffer.
Sourcepub fn reset(&mut self) -> EditRope
pub fn reset(&mut self) -> EditRope
Clear the text box’s underlying buffer of its content, and return it.
Sourcepub fn reset_text(&mut self) -> String
pub fn reset_text(&mut self) -> String
Clear the text box’s underlying buffer of its content, and return it as a String.
Sourcepub fn set_left_gutter(&mut self, line: usize, s: String, style: Option<Style>)
pub fn set_left_gutter(&mut self, line: usize, s: String, style: Option<Style>)
Create or update a line annotation for the left gutter.
Sourcepub fn set_right_gutter(&mut self, line: usize, s: String, style: Option<Style>)
pub fn set_right_gutter(&mut self, line: usize, s: String, style: Option<Style>)
Create or update a line annotation for the right gutter.
Sourcepub fn set_wrap(&mut self, wrap: bool)
pub fn set_wrap(&mut self, wrap: bool)
Control whether the text box should wrap long lines when displaying them.
Sourcepub fn set_term_info(&mut self, area: Rect)
pub fn set_term_info(&mut self, area: Rect)
Inform the text box what its dimensions and placement on the terminal window is.
Sourcepub fn get_cursor(&mut self) -> Cursor
pub fn get_cursor(&mut self) -> Cursor
Get the leader cursor for this text box’s cursor group.
Sourcepub fn has_lines(&self, max: usize) -> usize
pub fn has_lines(&self, max: usize) -> usize
Check whether this text box is capable of displaying max lines.
If there are fewer lines available than max, this returns the same value as
get_lines().
Otherwise, this returns max.
This method is useful for building additional widgets that want to create a TextBox with a
flexible height up to max lines.
Trait Implementations§
Source§impl<I> Editable<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
impl<I> Editable<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
Source§fn editor_command(
&mut self,
act: &EditorAction,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn editor_command( &mut self, act: &EditorAction, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<EditInfo, I>
Source§impl<I> Jumpable<EditContext, I> for TextBoxState<I>where
I: ApplicationInfo,
impl<I> Jumpable<EditContext, I> for TextBoxState<I>where
I: ApplicationInfo,
Source§fn jump(
&mut self,
list: PositionList,
dir: MoveDir1D,
count: usize,
ctx: &EditContext,
) -> UIResult<usize, I>
fn jump( &mut self, list: PositionList, dir: MoveDir1D, count: usize, ctx: &EditContext, ) -> UIResult<usize, I>
Source§impl<I> Promptable<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
impl<I> Promptable<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
Source§fn prompt(
&mut self,
_: &PromptAction,
_: &EditContext,
_: &mut Store<I>,
) -> EditResult<Vec<(Action<I>, EditContext)>, I>
fn prompt( &mut self, _: &PromptAction, _: &EditContext, _: &mut Store<I>, ) -> EditResult<Vec<(Action<I>, EditContext)>, I>
Source§impl<I> ScrollActions<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
impl<I> ScrollActions<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
Source§fn dirscroll(
&mut self,
dir: MoveDir2D,
size: ScrollSize,
count: &Count,
ctx: &EditContext,
_: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn dirscroll( &mut self, dir: MoveDir2D, size: ScrollSize, count: &Count, ctx: &EditContext, _: &mut Store<I>, ) -> EditResult<EditInfo, I>
Source§fn cursorpos(
&mut self,
pos: MovePosition,
axis: Axis,
_: &EditContext,
_: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn cursorpos( &mut self, pos: MovePosition, axis: Axis, _: &EditContext, _: &mut Store<I>, ) -> EditResult<EditInfo, I>
Source§fn linepos(
&mut self,
pos: MovePosition,
count: &Count,
ctx: &EditContext,
_: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn linepos( &mut self, pos: MovePosition, count: &Count, ctx: &EditContext, _: &mut Store<I>, ) -> EditResult<EditInfo, I>
Source§impl<I> Scrollable<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
impl<I> Scrollable<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
Source§fn scroll(
&mut self,
style: &ScrollStyle,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn scroll( &mut self, style: &ScrollStyle, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<EditInfo, I>
Source§impl<I> Searchable<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
impl<I> Searchable<EditContext, Store<I>, I> for TextBoxState<I>where
I: ApplicationInfo,
Source§fn search(
&mut self,
dir: MoveDirMod,
count: Count,
ctx: &EditContext,
store: &mut Store<I>,
) -> UIResult<EditInfo, I>
fn search( &mut self, dir: MoveDirMod, count: Count, ctx: &EditContext, store: &mut Store<I>, ) -> UIResult<EditInfo, I>
Source§impl<I> TerminalCursor for TextBoxState<I>where
I: ApplicationInfo,
impl<I> TerminalCursor for TextBoxState<I>where
I: ApplicationInfo,
Source§impl<I> WindowOps<I> for TextBoxState<I>where
I: ApplicationInfo,
impl<I> WindowOps<I> for TextBoxState<I>where
I: ApplicationInfo,
Source§fn close(&mut self, _: CloseFlags, _: &mut Store<I>) -> bool
fn close(&mut self, _: CloseFlags, _: &mut Store<I>) -> bool
Source§fn write(
&mut self,
_: Option<&str>,
_: WriteFlags,
_: &mut Store<I>,
) -> UIResult<EditInfo, I>
fn write( &mut self, _: Option<&str>, _: WriteFlags, _: &mut Store<I>, ) -> UIResult<EditInfo, I>
Source§fn draw(&mut self, area: Rect, buf: &mut Buffer, _: bool, _: &mut Store<I>)
fn draw(&mut self, area: Rect, buf: &mut Buffer, _: bool, _: &mut Store<I>)
Source§fn get_completions(&self) -> Option<CompletionList>
fn get_completions(&self) -> Option<CompletionList>
Source§fn get_cursor_word(&self, style: &WordStyle) -> Option<String>
fn get_cursor_word(&self, style: &WordStyle) -> Option<String>
Source§fn get_selected_word(&self) -> Option<String>
fn get_selected_word(&self) -> Option<String>
Auto Trait Implementations§
impl<I> Freeze for TextBoxState<I>
impl<I> RefUnwindSafe for TextBoxState<I>
impl<I> Send for TextBoxState<I>
impl<I> Sync for TextBoxState<I>
impl<I> Unpin for TextBoxState<I>
impl<I> UnsafeUnpin for TextBoxState<I>
impl<I> UnwindSafe for TextBoxState<I>
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> 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