Struct text_document::text_cursor::TextCursor
source · [−]pub struct TextCursor { /* private fields */ }
Implementations
sourceimpl 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
sourceimpl Clone for TextCursor
impl Clone for TextCursor
sourcefn clone(&self) -> TextCursor
fn clone(&self) -> TextCursor
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl !RefUnwindSafe for TextCursor
impl !Send for TextCursor
impl !Sync for TextCursor
impl Unpin for TextCursor
impl !UnwindSafe for TextCursor
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more