Struct termwiz::lineedit::NopLineEditorHost
source · [−]pub struct NopLineEditorHost { /* private fields */ }
Expand description
A concrete implementation of LineEditorHost
that uses the default behaviors.
Trait Implementations
sourceimpl Default for NopLineEditorHost
impl Default for NopLineEditorHost
sourcefn default() -> NopLineEditorHost
fn default() -> NopLineEditorHost
Returns the “default value” for a type. Read more
sourceimpl LineEditorHost for NopLineEditorHost
impl LineEditorHost for NopLineEditorHost
sourcefn render_prompt(&self, prompt: &str) -> Vec<OutputElement>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn render_prompt(&self, prompt: &str) -> Vec<OutputElement>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Given a prompt string, return the rendered form of the prompt as
a sequence of OutputElement
instances.
The implementation is free to interpret the prompt string however
it chooses; for instance, the application can opt to expand its own
application specific escape sequences as it sees fit.
The OutputElement
type allows returning graphic attribute changes
as well as textual output.
The default implementation returns the prompt as-is with no coloring
and no textual transformation. Read more
sourcefn render_preview(&self, _line: &str) -> Vec<OutputElement>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn render_preview(&self, _line: &str) -> Vec<OutputElement>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Given a reference to the current line being edited, render a preview of its outcome. The preview is cleared when the input is accepted, or canceled. Read more
sourcefn highlight_line(
&self,
line: &str,
cursor_position: usize
) -> (Vec<OutputElement>, usize)
fn highlight_line(
&self,
line: &str,
cursor_position: usize
) -> (Vec<OutputElement>, usize)
Given a reference to the current line being edited and the position
of the cursor, return the rendered form of the line as a sequence
of OutputElement
instances.
While this interface technically allows returning arbitrary Text sequences,
the application should preserve the column positions of the graphemes,
otherwise the terminal cursor position won’t match up to the correct
location.
The OutputElement
type allows returning graphic attribute changes
as well as textual output.
The default implementation returns the line as-is with no coloring. Read more
sourcefn complete(
&self,
_line: &str,
_cursor_position: usize
) -> Vec<CompletionCandidate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn complete(
&self,
_line: &str,
_cursor_position: usize
) -> Vec<CompletionCandidate>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Tab completion support. The line and current cursor position are provided and it is up to the embedding application to produce a list of completion candidates. The default implementation is an empty list. Read more
sourcefn resolve_action(
&mut self,
_event: &InputEvent,
_editor: &mut LineEditor<'_>
) -> Option<Action>
fn resolve_action(
&mut self,
_event: &InputEvent,
_editor: &mut LineEditor<'_>
) -> Option<Action>
Allows the embedding application an opportunity to override or
remap keys to alternative actions.
Return None
to indicate that the default keymap processing
should occur.
Otherwise return an Action
enum variant indicating the action
that should be taken.
Use Some(Action::NoAction)
to indicate that no action should be taken.
editor
is provided so that your application can implement custom
actions and apply them to the editor buffer. Use LineEditor::get_line_and_cursor
and LineEditor::set_line_and_cursor
for that and return Some(Action::NoAction)
to prevent any default action from being taken. Read more
Auto Trait Implementations
impl RefUnwindSafe for NopLineEditorHost
impl Send for NopLineEditorHost
impl Sync for NopLineEditorHost
impl Unpin for NopLineEditorHost
impl UnwindSafe for NopLineEditorHost
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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