pub struct TextCursor { /* private fields */ }
Implementations§
Source§impl TextCursor
impl TextCursor
pub fn position(&self) -> usize
pub fn anchor_position(&self) -> usize
Sourcepub fn set_position(&mut self, position: usize, move_mode: MoveMode)
pub fn set_position(&mut self, position: usize, move_mode: MoveMode)
set the cursor position, with or without the anchor depending of move_mode. Ensure that the cursor position is in the document.
Sourcepub fn current_block(&self) -> Weak<Block>
pub fn current_block(&self) -> Weak<Block>
Give the current block under the cursor position
pub fn set_block_format( &mut self, block_format: &BlockFormat, ) -> Result<(), ModelError>
pub fn merge_block_format( &mut self, block_format: &BlockFormat, ) -> Result<(), ModelError>
pub fn insert_block(&mut self) -> Result<Weak<Block>, ModelError>
Sourcepub fn current_frame(&self) -> Weak<Frame>
pub fn current_frame(&self) -> Weak<Frame>
Give the current frame under the cursor position
pub fn set_frame_format( &mut self, frame_format: &FrameFormat, ) -> Result<(), ModelError>
pub fn merge_frame_format( &mut self, frame_format: &FrameFormat, ) -> Result<(), ModelError>
Sourcepub fn insert_frame(&mut self) -> Result<Weak<Frame>, ModelError>
pub fn insert_frame(&mut self) -> Result<Weak<Frame>, ModelError>
insert a frame at the cursor position
Sourcepub fn insert_plain_text<S: Into<String>>(
&mut self,
plain_text: S,
) -> Result<(usize, usize), ModelError>
pub fn insert_plain_text<S: Into<String>>( &mut self, plain_text: S, ) -> Result<(usize, usize), ModelError>
Insert plain text and return (start position, end position)
pub fn selected_text(&self) -> String
pub fn text_format(&self) -> Option<TextFormat>
pub fn block_format(&self) -> Option<BlockFormat>
pub fn frame_format(&self) -> Option<FrameFormat>
Sourcepub fn remove(&mut self) -> Result<(usize, usize), ModelError>
pub fn remove(&mut self) -> Result<(usize, usize), ModelError>
Remove elements between two positions. Split blocks if needed. Frames in superior level (i.e. children) are completely removed even if only a part of it is selected
Return new position and number of removed chars
pub fn move_position( &mut self, move_operation: MoveOperation, move_mode: MoveMode, )
Trait Implementations§
Source§impl Clone for TextCursor
impl Clone for TextCursor
Source§fn clone(&self) -> TextCursor
fn clone(&self) -> TextCursor
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for TextCursor
impl !RefUnwindSafe for TextCursor
impl !Send for TextCursor
impl !Sync for TextCursor
impl Unpin for TextCursor
impl !UnwindSafe for TextCursor
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