Struct cosmic_text::Editor
source · pub struct Editor<'buffer> { /* private fields */ }
Expand description
A wrapper of [Buffer
] for easy editing
Implementations§
Trait Implementations§
source§impl<'buffer> Edit<'buffer> for Editor<'buffer>
impl<'buffer> Edit<'buffer> for Editor<'buffer>
source§fn buffer_ref(&self) -> &BufferRef<'buffer>
fn buffer_ref(&self) -> &BufferRef<'buffer>
Get the internal
BufferRef
source§fn buffer_ref_mut(&mut self) -> &mut BufferRef<'buffer>
fn buffer_ref_mut(&mut self) -> &mut BufferRef<'buffer>
Get the internal
BufferRef
source§fn set_cursor(&mut self, cursor: Cursor)
fn set_cursor(&mut self, cursor: Cursor)
Set the current cursor
source§fn set_selection(&mut self, selection: Selection)
fn set_selection(&mut self, selection: Selection)
Set the current selection position
source§fn auto_indent(&self) -> bool
fn auto_indent(&self) -> bool
Get the current automatic indentation setting
source§fn set_auto_indent(&mut self, auto_indent: bool)
fn set_auto_indent(&mut self, auto_indent: bool)
Enable or disable automatic indentation
source§fn set_tab_width(&mut self, font_system: &mut FontSystem, tab_width: u16)
fn set_tab_width(&mut self, font_system: &mut FontSystem, tab_width: u16)
Set the current tab width. A
tab_width
of 0 is not allowed, and will be ignoredsource§fn shape_as_needed(&mut self, font_system: &mut FontSystem, prune: bool)
fn shape_as_needed(&mut self, font_system: &mut FontSystem, prune: bool)
Shape lines until scroll, after adjusting scroll if the cursor moved
source§fn delete_range(&mut self, start: Cursor, end: Cursor)
fn delete_range(&mut self, start: Cursor, end: Cursor)
Delete text starting at start Cursor and ending at end Cursor
source§fn insert_at(
&mut self,
cursor: Cursor,
data: &str,
attrs_list: Option<AttrsList>,
) -> Cursor
fn insert_at( &mut self, cursor: Cursor, data: &str, attrs_list: Option<AttrsList>, ) -> Cursor
Insert text at specified cursor with specified attrs_list
source§fn copy_selection(&self) -> Option<String>
fn copy_selection(&self) -> Option<String>
Copy selection
source§fn delete_selection(&mut self) -> bool
fn delete_selection(&mut self) -> bool
Delete selection, adjusting cursor and returning true if there was a selection
source§fn apply_change(&mut self, change: &Change) -> bool
fn apply_change(&mut self, change: &Change) -> bool
Apply a change
source§fn start_change(&mut self)
fn start_change(&mut self)
Start collecting change
source§fn finish_change(&mut self) -> Option<Change>
fn finish_change(&mut self) -> Option<Change>
Get completed change
source§fn action(&mut self, font_system: &mut FontSystem, action: Action)
fn action(&mut self, font_system: &mut FontSystem, action: Action)
Perform an Action on the editor
source§fn cursor_position(&self) -> Option<(i32, i32)>
fn cursor_position(&self) -> Option<(i32, i32)>
Get X and Y position of the top left corner of the cursor
source§fn borrow_with<'font_system>(
&'font_system mut self,
font_system: &'font_system mut FontSystem,
) -> BorrowedWithFontSystem<'font_system, Self>where
Self: Sized,
fn borrow_with<'font_system>(
&'font_system mut self,
font_system: &'font_system mut FontSystem,
) -> BorrowedWithFontSystem<'font_system, Self>where
Self: Sized,
Mutably borrows
self
together with an FontSystem
for more convenient methodssource§fn with_buffer_mut<F: FnOnce(&mut Buffer) -> T, T>(&mut self, f: F) -> T
fn with_buffer_mut<F: FnOnce(&mut Buffer) -> T, T>(&mut self, f: F) -> T
Get the internal
Buffer
, mutablysource§fn set_redraw(&mut self, redraw: bool)
fn set_redraw(&mut self, redraw: bool)
Set the
Buffer
redraw flagAuto Trait Implementations§
impl<'buffer> Freeze for Editor<'buffer>
impl<'buffer> RefUnwindSafe for Editor<'buffer>
impl<'buffer> Send for Editor<'buffer>
impl<'buffer> Sync for Editor<'buffer>
impl<'buffer> Unpin for Editor<'buffer>
impl<'buffer> !UnwindSafe for Editor<'buffer>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more