Struct linefeed::prompter::Prompter
[−]
[src]
pub struct Prompter<'a, 'b: 'a, Term: 'b + Terminal> { /* fields omitted */ }
Provides access to the current state of input while a read_line
call
is in progress.
Holds read and write locks on terminal operations.
See Interface
for more information about concurrent operations.
Instances of this type cannot be constructed by public methods.
Instead, an instance is created internally during a call to read_line
.
Methods
impl<'a, 'b: 'a, Term: 'b + Terminal> Prompter<'a, 'b, Term>
[src]
pub fn buffer(&self) -> &str
[src]
Returns the current buffer.
pub fn backup_buffer(&self) -> &str
[src]
Returns the "backup" buffer.
When the user is currently editing a history entry, the backup buffer contains the original user input.
pub fn last_command_category(&self) -> Category
[src]
Returns the command Category
of the most recently executed command.
Some commands may use this to influence behavior of repeated commands.
pub fn word_break_chars(&self) -> &str
[src]
Returns the set of characters that indicate a word break.
pub fn set_buffer(&mut self, buf: &str) -> Result<()>
[src]
Sets the buffer to the given value. The cursor is moved to the end of the buffer.
pub fn cursor(&self) -> usize
[src]
Returns the current position of the cursor.
pub fn set_cursor(&mut self, pos: usize) -> Result<()>
[src]
Sets the cursor to the given position within the buffer.
Panics
If the given position is out of bounds or is not aligned to char
boundaries.
pub fn screen_size(&self) -> Size
[src]
Returns the size of the terminal at the last draw operation.
pub fn explicit_arg(&self) -> bool
[src]
Returns whether a numerical argument was explicitly supplied by the user.
pub fn sequence(&self) -> &str
[src]
Returns the current input sequence.
ⓘImportant traits for BindingIter<'a>pub fn bindings(&self) -> BindingIter
[src]
Returns an iterator over bound sequences
ⓘImportant traits for VariableIter<'a>pub fn variables(&self) -> VariableIter
[src]
Returns an iterator over variable values.
ⓘImportant traits for HistoryIter<'a>pub fn history(&self) -> HistoryIter
[src]
Returns an iterator over history entries
pub fn history_index(&self) -> Option<usize>
[src]
Returns the index into history currently being edited.
If the user is not editing a line of history, None
is returned.
pub fn history_len(&self) -> usize
[src]
Returns the current number of history entries.
pub fn select_history_entry(&mut self, new: Option<usize>) -> Result<()>
[src]
Selects the history entry currently being edited by the user.
Setting the entry to None
will result in editing the input buffer.
pub fn completions(&self) -> Option<&[Completion]>
[src]
Returns the current set of completions.
Unless the most recent command executed was one operating on completion
sets, the result is None
.
pub fn set_completions(&mut self, completions: Option<Vec<Completion>>)
[src]
Sets the current set of completions.
This completion set is accessed by commands such as complete
and
possible-completions
.
This set will only remain active until the end of the next
non-completion command's execution. Therefore, any Function
that uses this method must be of the Complete
category.
pub fn blink(&mut self, pos: usize) -> Result<()>
[src]
Moves the cursor to the given position, waits for 500 milliseconds (or until next user input), then restores the original cursor position.
Panics
If the given position is out of bounds or is not aligned to char
boundaries.
pub fn delete_range<R: RangeArgument<usize>>(&mut self, range: R) -> Result<()>
[src]
Deletes a range of text from the input buffer.
Panics
If the given range is out of bounds or is not aligned to char
boundaries.
pub fn kill_range<R: RangeArgument<usize>>(&mut self, range: R) -> Result<()>
[src]
Deletes a range from the buffer and adds the removed text to the kill ring.
Panics
If the given range is out of bounds or is not aligned to char
boundaries.
pub fn transpose_range(
&mut self,
src: Range<usize>,
dest: Range<usize>
) -> Result<()>
[src]
&mut self,
src: Range<usize>,
dest: Range<usize>
) -> Result<()>
Transposes two regions of the buffer, src
and dest
.
The cursor is placed at the end of the new location of src
.
Panics
If src
and dest
overlap, are out of bounds,
or are not aligned to char
boundaries.
pub fn yank(&mut self) -> Result<()>
[src]
Insert text from the front of the kill ring at the current cursor position. The cursor is placed at the end of the new text.
pub fn yank_pop(&mut self) -> Result<()>
[src]
Rotates the kill ring and replaces yanked text with the new front.
If the previous operation was not yank
, this has no effect.
pub fn insert(&mut self, n: usize, ch: char) -> Result<()>
[src]
Insert a given character at the current cursor position n
times.
The cursor position remains the same.
pub fn insert_str(&mut self, s: &str) -> Result<()>
[src]
Insert a string at the current cursor position.
The cursor position remains the same.
pub fn replace_str_backward<R: RangeArgument<usize>>(
&mut self,
range: R,
s: &str
) -> Result<()>
[src]
&mut self,
range: R,
s: &str
) -> Result<()>
Replaces a range in the buffer and redraws.
The cursor is placed at the start of the range.
pub fn replace_str_forward<R: RangeArgument<usize>>(
&mut self,
range: R,
s: &str
) -> Result<()>
[src]
&mut self,
range: R,
s: &str
) -> Result<()>
Replaces a range in the buffer and redraws.
The cursor is placed at the end of the new string.