Skip to main content

Line

Struct Line 

Source
pub struct Line { /* private fields */ }

Implementations§

Source§

impl Line

Source

pub fn text(&self) -> String

Source

pub fn is_empty(&self) -> bool

Source

pub fn mode(&self) -> Mode

Source

pub fn cursor(&self) -> usize

cursor position as a char index, for drawing the block.

Source

pub fn pending(&self) -> String

the pending command, echoed in the footer the way vi shows one.

Source

pub fn accept(&mut self) -> String

accept the line: record it in history and start a fresh one in insert mode, the way hitting enter in any chat client does.

Source

pub fn history(&self) -> &[String]

sent lines, oldest first — what the face persists.

Source

pub fn history_rev(&self) -> u32

changes every time accept records a line.

Source

pub fn set_history(&mut self, lines: impl IntoIterator<Item = String>)

seed history from disk: blanks and repeats dropped, only the newest HISTORY_CAP kept.

Source

pub fn reset(&mut self)

throw the draft away and return to insert mode.

Source

pub fn focus(&mut self)

entering the composer always starts in insert mode — you came here to type, and the draft you left behind is still there.

Source

pub fn replace_range(&mut self, lo: usize, hi: usize, s: &str)

replace lo..hi (char indices) with s, leaving the cursor after the inserted text. undoable. this is the completion hook: tab swaps the word under the cursor for a candidate without the editor knowing why.

Source

pub fn key(&mut self, k: KeyEvent) -> Act

Trait Implementations§

Source§

impl Default for Line

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for Line

§

impl Freeze for Line

§

impl Move for Line

§

impl RefUnwindSafe for Line

§

impl Send for Line

§

impl Sync for Line

§

impl Unpin for Line

§

impl UnsafeUnpin for Line

§

impl UnwindSafe for Line

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.