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.
Members
load_from_streamsave_to_streamcan_copycan_paste_from_clipboard_asyncnewfrom_editordocumenteditortexttext_lengthselectionget_rangedocument_rangeget_range_from_pointset_textget_default_character_formatset_default_character_formatget_default_paragraph_formatset_default_paragraph_formatdefault_tab_stopset_default_tab_stopget_textset_text_with_optionsundo_limitset_undo_limitclear_undo_redo_historycan_undocan_redoundoredoedit_groupfield_story
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.
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.
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.
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.
new
fn new(document: RichTextDocument) -> Self
from_editor
fn from_editor(editor: Rc<RichTextEditor>) -> Self
document
fn document(self: &Self) -> RichTextDocument
editor
fn editor(self: &Self) -> Rc<RichTextEditor>
text
fn text(self: &Self) -> String
text_length
fn text_length(self: &Self) -> usize
selection
fn selection(self: &Self) -> RichEditTextSelection
get_range
fn get_range(self: &Self, start: usize, end: usize) -> Result<RichEditTextRange, EditError>
document_range
fn document_range(self: &Self) -> Result<RichEditTextRange, EditError>
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.
set_text
fn set_text(self: &Self, text: &str) -> Result<(), EditError>
get_default_character_format
fn get_default_character_format(self: &Self) -> CharacterFormat
set_default_character_format
fn set_default_character_format(self: &Self, format: &CharacterFormat) -> Result<(), EditError>
get_default_paragraph_format
fn get_default_paragraph_format(self: &Self) -> ParagraphFormat
set_default_paragraph_format
fn set_default_paragraph_format(self: &Self, format: &ParagraphFormat) -> Result<(), EditError>
default_tab_stop
fn default_tab_stop(self: &Self) -> f64
Default tab spacing in TOM points; shared by all facades of this editor.
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.
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.
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.
undo_limit
fn undo_limit(self: &Self) -> usize
set_undo_limit
fn set_undo_limit(self: &Self, limit: usize)
clear_undo_redo_history
fn clear_undo_redo_history(self: &Self)
can_undo
fn can_undo(self: &Self) -> bool
can_redo
fn can_redo(self: &Self) -> bool
undo
fn undo(self: &Self) -> Result<bool, EditError>
redo
fn redo(self: &Self) -> Result<bool, EditError>
edit_group
fn edit_group<T>(self: &Self, edit: impl FnOnce(&Self) -> Result<T, EditError>) -> Result<T, EditError>
field_story
fn field_story(self: &Self) -> RichEditTextFieldStory
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedClassDefaultsErasedDestructorIntoEitherClone
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.