[−][src]Struct liner::Buffer
A buffer for text in the line editor.
It keeps track of each action performed on it for use with undo/redo.
Methods
impl Buffer
[src]
pub fn new() -> Self
[src]
pub fn clear_actions(&mut self)
[src]
pub fn start_undo_group(&mut self)
[src]
pub fn end_undo_group(&mut self)
[src]
pub fn undo(&mut self) -> bool
[src]
pub fn redo(&mut self) -> bool
[src]
pub fn revert(&mut self) -> bool
[src]
pub fn last_arg(&self) -> Option<&[char]>
[src]
pub fn num_chars(&self) -> usize
[src]
pub fn num_bytes(&self) -> usize
[src]
pub fn char_before(&self, cursor: usize) -> Option<char>
[src]
pub fn char_after(&self, cursor: usize) -> Option<char>
[src]
pub fn remove(&mut self, start: usize, end: usize) -> usize
[src]
Returns the number of characters removed.
pub fn insert(&mut self, start: usize, text: &[char])
[src]
pub fn insert_from_buffer(&mut self, other: &Buffer)
[src]
pub fn copy_buffer(&mut self, other: &Buffer)
[src]
pub fn range(&self, start: usize, end: usize) -> String
[src]
pub fn range_chars(&self, start: usize, end: usize) -> Vec<char>
[src]
pub fn width(&self) -> Vec<usize>
[src]
pub fn range_width(&self, start: usize, end: usize) -> Vec<usize>
[src]
pub fn lines(&self) -> Vec<String>
[src]
pub fn chars(&self) -> Iter<char>
[src]
pub fn truncate(&mut self, num: usize)
[src]
pub fn print<W>(&self, out: &mut W) -> Result<()> where
W: Write,
[src]
W: Write,
pub fn as_bytes(&self) -> Vec<u8>
[src]
pub fn print_rest<W>(&self, out: &mut W, after: usize) -> Result<usize> where
W: Write,
[src]
W: Write,
Takes other buffer, measures its length and prints this buffer from the point where the other stopped. Used to implement autosuggestions.
pub fn starts_with(&self, other: &Buffer) -> bool
[src]
Check if the other buffer starts with the same content as this one. Used to implement autosuggestions.
pub fn contains(&self, pattern: &Buffer) -> bool
[src]
Check if the buffer contains pattern. Used to implement history search.
pub fn is_empty(&self) -> bool
[src]
Return true if the buffer is empty.
Trait Implementations
impl From<Buffer> for String
[src]
impl From<String> for Buffer
[src]
impl<'a> From<&'a str> for Buffer
[src]
impl Clone for Buffer
[src]
impl Default for Buffer
[src]
impl Eq for Buffer
[src]
impl PartialEq<Buffer> for Buffer
[src]
impl Debug for Buffer
[src]
impl Display for Buffer
[src]
impl FromIterator<char> for Buffer
[src]
fn from_iter<T: IntoIterator<Item = char>>(t: T) -> Self
[src]
Auto Trait Implementations
impl Send for Buffer
impl Sync for Buffer
impl Unpin for Buffer
impl UnwindSafe for Buffer
impl RefUnwindSafe for Buffer
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,