FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    RichEditTextDocument

    struct · ferroui-controls · v0.5.0

    struct RichEditTextDocument
    

    Editing services over a shared FerroUI document. Range objects and selection commands use the same transaction history as the visual editor, and can also be used headlessly.

    View source

    Members

    load_from_stream

    fn load_from_stream(self: &Self, options: TextSetOptions, reader: &mut dyn Read, stream: TextStreamOptions) -> Result<(), TextOperationError>
    

    Loads from the reader's current position. I/O, decoding, and parsing finish before document/default/history changes or composition cancellation. The caller retains ownership of the reader; it is never sought or closed.

    Source

    save_to_stream

    fn save_to_stream(self: &Self, options: TextGetOptions, writer: &mut dyn Write, stream: TextStreamOptions) -> Result<(), TextOperationError>
    

    Writes an encoded snapshot at the writer's current position. Validation and encoding finish before the first write. An I/O error may leave a written prefix; this method never seeks, truncates, flushes, or closes the writer.

    Source

    can_copy

    fn can_copy(self: &Self) -> bool
    

    Whether copying document content is permitted. This is independent of selection length and edit protection. FerroUI documents currently have no copy-protection policy, so copying is permitted even for an empty or read-only document.

    Source

    can_paste_from_clipboard_async

    fn can_paste_from_clipboard_async(self: &Self, clipboard: Rc<dyn IClipboard>) -> LocalBoxFuture<Result<bool, ClipboardError>>
    

    Queries the clipboard's supported representations without reading their payloads or changing selection, composition, document state, or history.

    Source

    new

    fn new(document: RichTextDocument) -> Self
    

    Source

    from_editor

    fn from_editor(editor: Rc<RichTextEditor>) -> Self
    

    Source

    document

    fn document(self: &Self) -> RichTextDocument
    

    Source

    editor

    fn editor(self: &Self) -> Rc<RichTextEditor>
    

    Source

    text

    fn text(self: &Self) -> String
    

    Source

    text_length

    fn text_length(self: &Self) -> usize
    

    Source

    selection

    fn selection(self: &Self) -> RichEditTextSelection
    

    Source

    get_range

    fn get_range(self: &Self, start: usize, end: usize) -> Result<RichEditTextRange, EditError>
    

    Source

    document_range

    fn document_range(self: &Self) -> Result<RichEditTextRange, EditError>
    

    Source

    get_range_from_point

    fn get_range_from_point(self: &Self, view: &RichTextBlock, point: Point) -> Result<RichEditTextRange, EditError>
    

    Hit tests the host's measured, shaped layout in local control coordinates.

    Source

    set_text

    fn set_text(self: &Self, text: &str) -> Result<(), EditError>
    

    Source

    get_default_character_format

    fn get_default_character_format(self: &Self) -> CharacterFormat
    

    Source

    set_default_character_format

    fn set_default_character_format(self: &Self, format: &CharacterFormat) -> Result<(), EditError>
    

    Source

    get_default_paragraph_format

    fn get_default_paragraph_format(self: &Self) -> ParagraphFormat
    

    Source

    set_default_paragraph_format

    fn set_default_paragraph_format(self: &Self, format: &ParagraphFormat) -> Result<(), EditError>
    

    Source

    default_tab_stop

    fn default_tab_stop(self: &Self) -> f64
    

    Default tab spacing in TOM points; shared by all facades of this editor.

    Source

    set_default_tab_stop

    fn set_default_tab_stop(self: &Self, points: f64) -> Result<(), EditError>
    

    Applies document-wide implicit tab spacing as one undoable format edit. Explicit paragraph stops and unrelated formatting are retained.

    Source

    get_text

    fn get_text(self: &Self, options: TextGetOptions) -> Result<String, TextOperationError>
    

    Retrieves native paragraph separators while retaining the model's UTF-16 coordinate system. The complete-story projection synthesizes its terminal paragraph mark for None or AllowFinalEop, as the source TOM fixture requires.

    Source

    set_text_with_options

    fn set_text_with_options(self: &Self, options: TextSetOptions, text: &str) -> Result<(), TextOperationError>
    

    Replaces the complete story and its paragraph metadata. Plain content starts with document defaults; RTF retains all formatting the codec can represent.

    Source

    undo_limit

    fn undo_limit(self: &Self) -> usize
    

    Source

    set_undo_limit

    fn set_undo_limit(self: &Self, limit: usize)
    

    Source

    clear_undo_redo_history

    fn clear_undo_redo_history(self: &Self)
    

    Source

    can_undo

    fn can_undo(self: &Self) -> bool
    

    Source

    can_redo

    fn can_redo(self: &Self) -> bool
    

    Source

    undo

    fn undo(self: &Self) -> Result<bool, EditError>
    

    Source

    redo

    fn redo(self: &Self) -> Result<bool, EditError>
    

    Source

    edit_group

    fn edit_group<T>(self: &Self, edit: impl FnOnce(&Self) -> Result<T, EditError>) -> Result<T, EditError>
    

    Source

    field_story

    fn field_story(self: &Self) -> RichEditTextFieldStory
    

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ClassDefaults
    • ErasedDestructor
    • IntoEither
    • Clone

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.