Struct TextCursor

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

Implementations§

Source§

impl TextCursor

Source

pub fn position(&self) -> usize

Source

pub fn anchor_position(&self) -> usize

Source

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.

Source

pub fn current_block(&self) -> Weak<Block>

Give the current block under the cursor position

Source

pub fn set_block_format( &mut self, block_format: &BlockFormat, ) -> Result<(), ModelError>

Source

pub fn merge_block_format( &mut self, block_format: &BlockFormat, ) -> Result<(), ModelError>

Source

pub fn insert_block(&mut self) -> Result<Weak<Block>, ModelError>

Source

pub fn current_frame(&self) -> Weak<Frame>

Give the current frame under the cursor position

Source

pub fn set_frame_format( &mut self, frame_format: &FrameFormat, ) -> Result<(), ModelError>

Source

pub fn merge_frame_format( &mut self, frame_format: &FrameFormat, ) -> Result<(), ModelError>

Source

pub fn insert_frame(&mut self) -> Result<Weak<Frame>, ModelError>

insert a frame at the cursor position

Source

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)

Source

pub fn selected_text(&self) -> String

Source

pub fn text_format(&self) -> Option<TextFormat>

Source

pub fn block_format(&self) -> Option<BlockFormat>

Source

pub fn frame_format(&self) -> Option<FrameFormat>

Source

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

Source

pub fn move_position( &mut self, move_operation: MoveOperation, move_mode: MoveMode, )

Trait Implementations§

Source§

impl Clone for TextCursor

Source§

fn clone(&self) -> TextCursor

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V