Skip to main content

RopeBuffer

Struct RopeBuffer 

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

Implementations§

Source§

impl RopeBuffer

Source

pub fn new() -> Self

Source

pub fn get_system_ansi_encoding() -> &'static Encoding

根據系統區域設置獲取 ANSI 編碼

Source

pub fn from_file_with_encoding( path: &Path, encoding_config: &EncodingConfig, ) -> Result<Self>

Source

pub fn insert_char(&mut self, pos: usize, ch: char)

Source

pub fn insert(&mut self, pos: usize, text: &str)

Source

pub fn delete_char(&mut self, pos: usize)

Source

pub fn delete_range(&mut self, start: usize, end: usize)

Source

pub fn delete_line(&mut self, row: usize)

Source

pub fn line_count(&self) -> usize

Source

pub fn line(&self, idx: usize) -> Option<RopeSlice<'_>>

Source

pub fn line_to_char(&self, line_idx: usize) -> usize

Source

pub fn char_to_line(&self, char_idx: usize) -> usize

Source

pub fn save(&mut self) -> Result<()>

Source

pub fn save_to(&mut self, path: &Path) -> Result<()>

Source

pub fn save_as(&mut self, path: &Path) -> Result<()>

Source

pub fn is_modified(&self) -> bool

Source

pub fn file_path(&self) -> Option<&Path>

Source

pub fn file_name(&self) -> String

Source

pub fn len_chars(&self) -> usize

Source

pub fn get_line_content(&self, line_idx: usize) -> String

Source

pub fn get_line_full(&self, line_idx: usize) -> String

獲取完整行內容(包括尾部空格和換行符)

Source

pub fn undo(&mut self) -> Option<usize>

Source

pub fn redo(&mut self) -> Option<usize>

Source

pub fn can_undo(&self) -> bool

Source

pub fn can_redo(&self) -> bool

Source

pub fn set_read_encoding(&mut self, encoding: &'static Encoding)

Source

pub fn set_save_encoding(&mut self, encoding: &'static Encoding)

設置存檔編碼

Source

pub fn save_encoding(&self) -> &'static Encoding

Source

pub fn reload_with_encoding( &mut self, encoding: &'static Encoding, ) -> Result<()>

使用指定編碼重新載入檔案

Source

pub fn change_encoding(&mut self, encoding: &'static Encoding)

為新建檔案設定編碼(無需重新載入)

Source

pub fn has_file_path(&self) -> bool

檢查是否有檔案路徑

Trait Implementations§

Source§

impl Default for RopeBuffer

Source§

fn default() -> Self

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> 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 = 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.