pub struct ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,{ /* private fields */ }Expand description
Persistent state for List.
Implementations§
Source§impl<T, I> ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
impl<T, I> ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
Trait Implementations§
Source§impl<T, I> CursorMovements<ListCursor> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
impl<T, I> CursorMovements<ListCursor> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
Source§fn first_word(
&self,
pos: &ListCursor,
_: &CursorMovementsContext<'_, ListCursor>,
) -> ListCursor
fn first_word( &self, pos: &ListCursor, _: &CursorMovementsContext<'_, ListCursor>, ) -> ListCursor
Calculate the position of the first word on the line of the provided cursor.
Source§fn movement(
&self,
pos: &ListCursor,
movement: &MoveType,
count: &Count,
ctx: &CursorMovementsContext<'_, ListCursor>,
) -> Option<ListCursor>
fn movement( &self, pos: &ListCursor, movement: &MoveType, count: &Count, ctx: &CursorMovementsContext<'_, ListCursor>, ) -> Option<ListCursor>
Calculate the position of the cursor after performing a movement.
Source§fn range_of_movement(
&self,
pos: &ListCursor,
movement: &MoveType,
count: &Count,
ctx: &CursorMovementsContext<'_, ListCursor>,
) -> Option<EditRange<ListCursor>>
fn range_of_movement( &self, pos: &ListCursor, movement: &MoveType, count: &Count, ctx: &CursorMovementsContext<'_, ListCursor>, ) -> Option<EditRange<ListCursor>>
Calculate a cursor range from the given cursor to the location after performing the
given movement.
Source§fn range(
&self,
pos: &ListCursor,
range: &RangeType,
_: bool,
count: &Count,
ctx: &CursorMovementsContext<'_, ListCursor>,
) -> Option<EditRange<ListCursor>>
fn range( &self, pos: &ListCursor, range: &RangeType, _: bool, count: &Count, ctx: &CursorMovementsContext<'_, ListCursor>, ) -> Option<EditRange<ListCursor>>
Calculate a cursor range based on a given cursor position and a RangeType.
Source§impl<T, I> CursorSearch<ListCursor> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
impl<T, I> CursorSearch<ListCursor> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
Source§fn find_char(
&self,
_: &ListCursor,
_: bool,
_: MoveDir1D,
_: bool,
_: char,
_: usize,
) -> Option<ListCursor>
fn find_char( &self, _: &ListCursor, _: bool, _: MoveDir1D, _: bool, _: char, _: usize, ) -> Option<ListCursor>
Search for a specific character.
Source§fn find_matches(
&self,
_: &ListCursor,
_: &ListCursor,
_: &Regex,
) -> Vec<EditRange<ListCursor>>
fn find_matches( &self, _: &ListCursor, _: &ListCursor, _: &Regex, ) -> Vec<EditRange<ListCursor>>
Find matches for a regular expression within a range.
Source§fn find_regex(
&self,
pos: &ListCursor,
dir: MoveDir1D,
needle: &Regex,
count: usize,
) -> Option<EditRange<ListCursor>>
fn find_regex( &self, pos: &ListCursor, dir: MoveDir1D, needle: &Regex, count: usize, ) -> Option<EditRange<ListCursor>>
Search for a regular expression.
Source§impl<T, I> Editable<EditContext, Store<I>, I> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
impl<T, I> Editable<EditContext, Store<I>, I> for ListState<T, I>where
T: ListItem<I>,
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>
Execute an editor action.
Source§impl<T, I> EditorActions<EditContext, Store<I>, I> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
impl<T, I> EditorActions<EditContext, Store<I>, I> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
Source§fn edit(
&mut self,
operation: &EditAction,
motion: &EditTarget,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn edit( &mut self, operation: &EditAction, motion: &EditTarget, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<EditInfo, I>
Perform an editing operation over the targeted text.
Source§fn mark(
&mut self,
name: Mark,
_: &EditContext,
store: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn mark( &mut self, name: Mark, _: &EditContext, store: &mut Store<I>, ) -> EditResult<EditInfo, I>
Create or update a cursor mark based on the leader’s cursor position.
Source§fn complete(
&mut self,
_: &CompletionStyle,
_: &CompletionType,
_: &CompletionDisplay,
_: &EditContext,
_: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn complete( &mut self, _: &CompletionStyle, _: &CompletionType, _: &CompletionDisplay, _: &EditContext, _: &mut Store<I>, ) -> EditResult<EditInfo, I>
Complete the text before the cursor group leader.
Source§fn insert_text(
&mut self,
_: &InsertTextAction,
_: &EditContext,
_: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn insert_text( &mut self, _: &InsertTextAction, _: &EditContext, _: &mut Store<I>, ) -> EditResult<EditInfo, I>
Insert text relative to the current cursor position.
Source§fn selection_command(
&mut self,
_: &SelectionAction,
_: &EditContext,
_: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn selection_command( &mut self, _: &SelectionAction, _: &EditContext, _: &mut Store<I>, ) -> EditResult<EditInfo, I>
Modify the current selection.
Source§fn history_command(
&mut self,
act: &HistoryAction,
_: &EditContext,
_: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn history_command( &mut self, act: &HistoryAction, _: &EditContext, _: &mut Store<I>, ) -> EditResult<EditInfo, I>
Move to a different point in the buffer’s editing history.
Source§fn cursor_command(
&mut self,
act: &CursorAction,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn cursor_command( &mut self, act: &CursorAction, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<EditInfo, I>
Perform an action over a cursor group.
Source§impl<T, I> Jumpable<EditContext, I> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
impl<T, I> Jumpable<EditContext, I> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
Source§fn jump(
&mut self,
list: PositionList,
dir: MoveDir1D,
count: usize,
_: &EditContext,
) -> UIResult<usize, I>
fn jump( &mut self, list: PositionList, dir: MoveDir1D, count: usize, _: &EditContext, ) -> UIResult<usize, I>
Source§impl<C, I, T> Promptable<C, Store<I>, I> for ListState<T, I>
impl<C, I, T> Promptable<C, Store<I>, I> for ListState<T, I>
Source§fn prompt(
&mut self,
act: &PromptAction,
ctx: &C,
store: &mut Store<I>,
) -> EditResult<Vec<(Action<I>, C)>, I>
fn prompt( &mut self, act: &PromptAction, ctx: &C, store: &mut Store<I>, ) -> EditResult<Vec<(Action<I>, C)>, I>
Execute a prompt action.
Source§impl<I, T> ScrollActions<EditContext, Store<I>, I> for ListState<T, I>where
I: ApplicationInfo,
T: ListItem<I>,
impl<I, T> ScrollActions<EditContext, Store<I>, I> for ListState<T, I>where
I: ApplicationInfo,
T: ListItem<I>,
Source§fn dirscroll(
&mut self,
dir: MoveDir2D,
size: ScrollSize,
count: &Count,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn dirscroll( &mut self, dir: MoveDir2D, size: ScrollSize, count: &Count, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<EditInfo, I>
Pan the viewport.
Source§fn cursorpos(
&mut self,
pos: MovePosition,
axis: Axis,
_: &EditContext,
store: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn cursorpos( &mut self, pos: MovePosition, axis: Axis, _: &EditContext, store: &mut Store<I>, ) -> EditResult<EditInfo, I>
Scroll so that the cursor is placed along a viewport boundary.
Source§fn linepos(
&mut self,
pos: MovePosition,
count: &Count,
ctx: &EditContext,
store: &mut Store<I>,
) -> EditResult<EditInfo, I>
fn linepos( &mut self, pos: MovePosition, count: &Count, ctx: &EditContext, store: &mut Store<I>, ) -> EditResult<EditInfo, I>
Scroll so that a specific line is placed at a given place in the viewport.
Source§impl<I, T> Scrollable<EditContext, Store<I>, I> for ListState<T, I>where
I: ApplicationInfo,
T: ListItem<I>,
impl<I, T> Scrollable<EditContext, Store<I>, I> for ListState<T, I>where
I: ApplicationInfo,
T: ListItem<I>,
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>
Scroll the viewable content in this object.
Source§impl<I, T> Searchable<EditContext, Store<I>, I> for ListState<T, I>where
I: ApplicationInfo,
T: ListItem<I>,
impl<I, T> Searchable<EditContext, Store<I>, I> for ListState<T, I>where
I: ApplicationInfo,
T: ListItem<I>,
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>
Search for the nth result in MoveDirMod direction.
Source§impl<T, I> TerminalCursor for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
impl<T, I> TerminalCursor for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
Source§impl<I, T> WindowOps<I> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
impl<I, T> WindowOps<I> for ListState<T, I>where
T: ListItem<I>,
I: ApplicationInfo,
Source§fn close(&mut self, _: CloseFlags, _: &mut Store<I>) -> bool
fn close(&mut self, _: CloseFlags, _: &mut Store<I>) -> bool
Perform any necessary cleanup for this window and close it. Read more
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>
Write the contents of the window.
Source§fn draw(
&mut self,
area: Rect,
buf: &mut Buffer,
focused: bool,
store: &mut Store<I>,
)
fn draw( &mut self, area: Rect, buf: &mut Buffer, focused: bool, store: &mut Store<I>, )
Draw this window into the buffer for the prescribed area.
Source§fn get_completions(&self) -> Option<CompletionList>
fn get_completions(&self) -> Option<CompletionList>
Get completion candidates to show the user.
Source§fn get_cursor_word(&self, _: &WordStyle) -> Option<String>
fn get_cursor_word(&self, _: &WordStyle) -> Option<String>
Returns the word following the current cursor position in this window.
Source§fn get_selected_word(&self) -> Option<String>
fn get_selected_word(&self) -> Option<String>
Returns the currently selected text in this window.
Auto Trait Implementations§
impl<T, I> Freeze for ListState<T, I>
impl<T, I> RefUnwindSafe for ListState<T, I>
impl<T, I> Send for ListState<T, I>where
T: Send,
impl<T, I> Sync for ListState<T, I>
impl<T, I> Unpin for ListState<T, I>
impl<T, I> UnsafeUnpin for ListState<T, I>
impl<T, I> UnwindSafe for ListState<T, 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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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