Skip to main content

Editor

Trait Editor 

Source
pub trait Editor {
    // Required methods
    fn content(&self) -> &str;
    fn cursor(&self) -> usize;
    fn set_cursor(&mut self, pos: usize);
    fn move_left(&mut self);
    fn move_right(&mut self);
    fn delete_char_forward(&mut self);
    fn insert_text(&mut self, text: &str);
    fn replace(&mut self, content: String, cursor: usize);

    // Provided method
    fn replace_range(&mut self, start: usize, end: usize, text: &str) { ... }
}
๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Expand description

Minimal text-editor surface required by the Vim engine.

Required Methodsยง

Source

fn content(&self) -> &str

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Source

fn cursor(&self) -> usize

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Source

fn set_cursor(&mut self, pos: usize)

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Source

fn move_left(&mut self)

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Source

fn move_right(&mut self)

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Source

fn delete_char_forward(&mut self)

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Source

fn insert_text(&mut self, text: &str)

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Source

fn replace(&mut self, content: String, cursor: usize)

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Provided Methodsยง

Source

fn replace_range(&mut self, start: usize, end: usize, text: &str)

๐Ÿ‘ŽDeprecated since 0.75.0:

vim mode relocated to oxicode-cli; oxicode-textarea owns text, CLI owns vim logic

Replace the byte range start..end with text in-place. Default implementation delegates to content().to_string() + replace().

Dyn Compatibilityยง

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementorsยง