Struct TextBuffer

Source
pub struct TextBuffer {
    pub lines: Vec<Vec<char>>,
    pub undo_stack: Vec<TextUndo>,
    pub redo_stack: Vec<TextUndo>,
    pub is_loaded: bool,
    pub signal: Signal,
    pub mutation_id: u64,
    pub is_crlf: bool,
    pub messages: TextBufferMessages,
    pub flat_text: Vec<char>,
    pub token_chunks: Vec<TokenChunk>,
    pub token_chunks_id: u64,
    pub keyboard: TextBufferKeyboard,
}

Fields§

§lines: Vec<Vec<char>>§undo_stack: Vec<TextUndo>§redo_stack: Vec<TextUndo>§is_loaded: bool§signal: Signal§mutation_id: u64§is_crlf: bool§messages: TextBufferMessages§flat_text: Vec<char>§token_chunks: Vec<TokenChunk>§token_chunks_id: u64§keyboard: TextBufferKeyboard

Implementations§

Source§

impl TextBuffer

Source§

impl TextBuffer

Source

pub fn with_signal(cx: &mut Cx) -> Self

Source

pub fn from_utf8(data: &str) -> Self

Source

pub fn needs_token_chunks(&mut self) -> bool

Source

pub fn offset_to_text_pos(&self, char_offset: usize) -> TextPos

Source

pub fn offset_to_text_pos_next( &self, query_off: usize, old_pos: TextPos, old_off: usize, ) -> TextPos

Source

pub fn text_pos_to_offset(&self, pos: TextPos) -> usize

Source

pub fn get_nearest_line_range(&self, offset: usize) -> (usize, usize)

Source

pub fn calc_next_line_indent_depth( &self, offset: usize, tabsize: usize, ) -> (usize, usize)

Source

pub fn calc_line_indent_depth(&self, row: usize) -> usize

Source

pub fn calc_backspace_line_indent_depth_and_pair( &self, offset: usize, ) -> (usize, usize)

Source

pub fn calc_deletion_whitespace( &self, offset: usize, ) -> Option<(usize, usize, usize, usize)>

Source

pub fn calc_deindent_whitespace( &self, offset: usize, ) -> Option<(usize, usize, usize)>

Source

pub fn calc_char_count(&self) -> usize

Source

pub fn get_line_count(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn get_range_as_string(&self, start: usize, len: usize, ret: &mut String)

Source

pub fn get_char(&self, start: usize) -> char

Source

pub fn get_as_string(&self) -> String

Source

pub fn send_textbuffer_loaded_signal(&self, cx: &mut Cx)

Source

pub fn load_from_utf8(&mut self, utf8: &str)

Source

pub fn replace_line( &mut self, row: usize, start_col: usize, len: usize, rep_line: Vec<char>, ) -> Vec<char>

Source

pub fn copy_line(&self, row: usize, start_col: usize, len: usize) -> Vec<char>

Source

pub fn replace_range( &mut self, start: usize, len: usize, rep_lines: Vec<Vec<char>>, ) -> Vec<Vec<char>>

Source

pub fn replace_lines( &mut self, start_row: usize, end_row: usize, rep_lines: Vec<Vec<char>>, ) -> TextOp

Source

pub fn split_string_to_lines(string: &str) -> Vec<Vec<char>>

Source

pub fn replace_lines_with_string( &mut self, start: usize, len: usize, string: &str, ) -> TextOp

Source

pub fn replace_line_with_string( &mut self, start: usize, row: usize, col: usize, len: usize, string: &str, ) -> TextOp

Source

pub fn replace_with_textop(&mut self, text_op: TextOp) -> TextOp

Source

pub fn save_buffer(&mut self)

Source

pub fn undoredo( &mut self, text_undo: TextUndo, cursor_set: &mut TextCursorSet, ) -> TextUndo

Source

pub fn undo(&mut self, grouped: bool, cursor_set: &mut TextCursorSet)

Source

pub fn redo(&mut self, grouped: bool, cursor_set: &mut TextCursorSet)

Trait Implementations§

Source§

impl Clone for TextBuffer

Source§

fn clone(&self) -> TextBuffer

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for TextBuffer

Source§

fn default() -> TextBuffer

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

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.