pub struct TextModel {
pub options: Options,
pub editing: LanguageEditing,
pub decorations: Decorations,
/* private fields */
}Fields§
§options: Options§editing: LanguageEditing§decorations: DecorationsRanges that move with edits (search matches, diagnostics, diff hunks).
Implementations§
Source§impl TextModel
impl TextModel
pub fn new(text: &str) -> Self
pub fn rope(&self) -> &Rope
pub fn text(&self) -> String
pub fn len_chars(&self) -> usize
Sourcepub fn version(&self) -> u64
pub fn version(&self) -> u64
Increases by one with every applied change set, including undo and redo.
pub fn line_ending(&self) -> LineEnding
pub fn can_undo(&self) -> bool
pub fn can_redo(&self) -> bool
Sourcepub fn checkpoint(&mut self)
pub fn checkpoint(&mut self)
Ends the current undo group explicitly.
Sourcepub fn set_text(&mut self, text: &str)
pub fn set_text(&mut self, text: &str)
Replaces the whole text and clears the undo history (like Monaco’s setValue).
The replacement goes through the log, so cursors and other consumers follow it.
Sourcepub fn apply_changes(&mut self, changes: &ChangeSet)
pub fn apply_changes(&mut self, changes: &ChangeSet)
Applies changes outside the undo history, for a copy of a text kept in step with
another editor’s (a language server’s documents). The log records them as usual.
Trait Implementations§
Auto Trait Implementations§
impl Forget for TextModel
impl Freeze for TextModel
impl Move for TextModel
impl RefUnwindSafe for TextModel
impl Send for TextModel
impl Sync for TextModel
impl Unpin for TextModel
impl UnsafeUnpin for TextModel
impl UnwindSafe for TextModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more