[][src]Struct tcalc_rustyline::line_buffer::LineBuffer

pub struct LineBuffer { /* fields omitted */ }

Methods

impl LineBuffer[src]

pub fn with_capacity(capacity: usize) -> LineBuffer[src]

Create a new line buffer with the given maximum capacity.

pub fn as_str(&self) -> &str[src]

Extracts a string slice containing the entire buffer.

pub fn into_string(self) -> String[src]

Converts a buffer into a String without copying or allocating.

pub fn pos(&self) -> usize[src]

Current cursor position (byte position)

pub fn set_pos(&mut self, pos: usize)[src]

pub fn len(&self) -> usize[src]

Returns the length of this buffer, in bytes.

pub fn is_empty(&self) -> bool[src]

Returns true if this buffer has a length of zero.

pub fn update(&mut self, buf: &str, pos: usize)[src]

Set line content (buf) and cursor position (pos).

pub fn backup(&mut self, src: &LineBuffer)[src]

Backup src

pub fn insert(&mut self, ch: char) -> Option<bool>[src]

Insert the character ch at current cursor position and advance cursor position accordingly. Return None when maximum buffer size has been reached, true when the character has been appended to the end of the line.

pub fn yank(&mut self, text: &str) -> Option<bool>[src]

Yank/paste text at current position. Return None when maximum buffer size has been reached, true when the character has been appended to the end of the line.

pub fn yank_pop(&mut self, yank_size: usize, text: &str) -> Option<bool>[src]

Delete previously yanked text and yank/paste text at current position.

pub fn move_left(&mut self) -> bool[src]

Move cursor on the left.

pub fn move_right(&mut self) -> bool[src]

Move cursor on the right.

pub fn move_home(&mut self) -> bool[src]

Move cursor to the start of the line.

pub fn move_end(&mut self) -> bool[src]

Move cursor to the end of the line.

pub fn delete(&mut self) -> bool[src]

Delete the character at the right of the cursor without altering the cursor position. Basically this is what happens with the "Delete" keyboard key.

pub fn backspace(&mut self) -> bool[src]

Delete the character at the left of the cursor. Basically that is what happens with the "Backspace" keyboard key.

pub fn kill_line(&mut self) -> Option<String>[src]

Kill the text from point to the end of the line.

pub fn discard_line(&mut self) -> Option<String>[src]

Kill backward from point to the beginning of the line.

pub fn transpose_chars(&mut self) -> bool[src]

Exchange the char before cursor with the character at cursor.

pub fn move_to_prev_word(&mut self) -> bool[src]

Moves the cursor to the beginning of previous word.

pub fn delete_prev_word<F>(&mut self, test: F) -> Option<String> where
    F: Fn(char) -> bool
[src]

Delete the previous word, maintaining the cursor at the start of the current word.

pub fn next_word_pos(&self, pos: usize) -> Option<(usize, usize)>[src]

Returns the position (start, end) of the next word.

pub fn move_to_next_word(&mut self) -> bool[src]

Moves the cursor to the end of next word.

pub fn delete_word(&mut self) -> Option<String>[src]

Kill from the cursor to the end of the current word, or, if between words, to the end of the next word.

pub fn edit_word(&mut self, a: WordAction) -> bool[src]

Alter the next word.

pub fn transpose_words(&mut self) -> bool[src]

Transpose two words

pub fn replace(&mut self, start: usize, end: usize, text: &str)[src]

Replaces the content between [start..end] with text and positions the cursor to the end of text.

Trait Implementations

impl Deref for LineBuffer[src]

type Target = str

The resulting type after dereferencing.

impl Debug for LineBuffer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]