# RichEditTextRange

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/rich_text/struct-richedittextrange/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct RichEditTextRange
```

A live, independent range. Explicit plain range SetText tracks its endpoints
as a pair from the accepted operation span. Other mutation origins retain the
document's ordinary TextPointer affinity policy.
RangeGravity independently selects formatting at a collapsed boundary.
Cloning shares the range object; `get_clone` creates independent endpoints.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L468)

## Members

- [`set_text_via_stream`](#function-set_text_via_stream)
- [`get_text_via_stream`](#function-get_text_via_stream)
- [`change_case`](#function-change_case)
- [`character`](#function-character)
- [`character_scalar`](#function-character_scalar)
- [`set_character`](#function-set_character)
- [`set_character_scalar`](#function-set_character_scalar)
- [`delete`](#function-delete)
- [`can_paste_from_clipboard_async`](#function-can_paste_from_clipboard_async)
- [`copy_to_clipboard_async`](#function-copy_to_clipboard_async)
- [`cut_to_clipboard_async`](#function-cut_to_clipboard_async)
- [`paste_from_clipboard_async`](#function-paste_from_clipboard_async)
- [`gravity`](#function-gravity)
- [`set_gravity`](#function-set_gravity)
- [`set_gravity_value`](#function-set_gravity_value)
- [`document`](#function-document)
- [`start_position`](#function-start_position)
- [`end_position`](#function-end_position)
- [`range`](#function-range)
- [`length`](#function-length)
- [`story_length`](#function-story_length)
- [`is_degenerate`](#function-is_degenerate)
- [`text`](#function-text)
- [`get_text`](#function-get_text)
- [`snapshot`](#function-snapshot)
- [`get_rectangles`](#function-get_rectangles)
- [`get_clone`](#function-get_clone)
- [`formatted_text`](#function-formatted_text)
- [`set_formatted_text`](#function-set_formatted_text)
- [`set_start_position`](#function-set_start_position)
- [`set_end_position`](#function-set_end_position)
- [`set_range`](#function-set_range)
- [`collapse`](#function-collapse)
- [`select`](#function-select)
- [`in_range`](#function-in_range)
- [`is_equal`](#function-is_equal)
- [`in_story`](#function-in_story)
- [`match_selection`](#function-match_selection)
- [`get_character_utf32`](#function-get_character_utf32)
- [`set_text`](#function-set_text)
- [`set_text_with_options`](#function-set_text_with_options)
- [`set_snapshot`](#function-set_snapshot)
- [`set_character_format`](#function-set_character_format)
- [`set_paragraph_format`](#function-set_paragraph_format)
- [`character_format`](#function-character_format)
- [`paragraph_format`](#function-paragraph_format)
- [`expand`](#function-expand)
- [`start_of`](#function-start_of)
- [`end_of`](#function-end_of)
- [`get_index`](#function-get_index)
- [`set_index`](#function-set_index)
- [`move_by`](#function-move_by)
- [`move_start`](#function-move_start)
- [`move_end`](#function-move_end)
- [`find`](#function-find)
- [`find_text`](#function-find_text)
- [`find_text_with_length`](#function-find_text_with_length)

<a id="function-set_text_via_stream"></a>

### set_text_via_stream

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

Replaces this live range from the reader's current position. The complete
payload is validated first; the editor's independent selection is rebased
and the replacement becomes one undoable operation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_stream.rs#L86)

<a id="function-get_text_via_stream"></a>

### get_text_via_stream

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

Writes this range without moving its endpoints or changing editor history.
The stream's position, lifetime, and completion/flush policy belong to the
caller, as in FerroUI's other Read/Write-based storage APIs.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_stream.rs#L107)

<a id="function-change_case"></a>

### change_case

```rust
fn change_case(self: &Self, value: LetterCase) -> Result<bool, EditError>
```

Changes the selected letters without flattening inline formatting, links,
paragraph properties, soft breaks or embedded controls. Unicode expansions
rebase the independent directed selection; the edit is one undo unit.

The complete selected string supplies contextual lowercase rules, even
across differently formatted runs. A degenerate or unchanged range returns
`false` without touching composition, revision, typing format or history.
An expansion exceeding MaxLength fails before replacing content rather
than truncating the transformed text. Locale-specific native casing remains
separate from this portable Unicode default-casing operation.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_case.rs#L44)

<a id="function-character"></a>

### character

```rust
fn character(self: &Self) -> u16
```

The UTF-16 code unit at StartPosition, including the leading surrogate of
a supplementary character. A caret at the end of this model story returns
zero; the native synthetic terminal paragraph marker is not exposed.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_range_operations.rs#L12)

<a id="function-character_scalar"></a>

### character_scalar

```rust
fn character_scalar(self: &Self) -> Option<char>
```

Returns the complete Unicode scalar at StartPosition, independently of
whether this range is degenerate. None means the end of the model story.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_range_operations.rs#L22)

<a id="function-set_character"></a>

### set_character

```rust
fn set_character(self: &Self, value: u16) -> Result<bool, EditError>
```

Replaces the first UTF-16 code unit without moving the range's start.
Isolated surrogate input and replacement of half an existing pair are
rejected before changing content, composition or history. Use
`set_character_scalar` for a complete scalar.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_range_operations.rs#L30)

<a id="function-set_character_scalar"></a>

### set_character_scalar

```rust
fn set_character_scalar(self: &Self, value: char) -> Result<bool, EditError>
```

Replaces the complete scalar at StartPosition. This Rust extension to the
native Char16 property supports supplementary characters without exposing
invalid intermediate UTF-16. It retains the replaced character's format,
rebases the independent directed selection, and creates one undo unit.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_range_operations.rs#L41)

<a id="function-delete"></a>

### delete

```rust
fn delete(self: &Self, unit: TextRangeUnit, count: i32) -> Result<usize, EditError>
```

Deletes this range and, for a nonzero count, additional logical units in
the requested direction. Removing a nonempty range counts as one unit;
count zero removes only that range. The return value is a nonnegative
count of removed units, using usize so even i32::MIN has no abs overflow.

A nonempty range is removed before resolving the remaining units: joining
its surrounding text can change word, paragraph and shaped line boundaries.
All changes use one undo transaction and preserve the independent editor
selection. Unavailable layout-dependent units fail explicitly.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_range_operations.rs#L166)

<a id="function-can_paste_from_clipboard_async"></a>

### can_paste_from_clipboard_async

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

Queries the exact requested format policy. Read-only targets return false
without accessing the clipboard. Availability does not validate a payload
that may be supplied lazily, or guarantee a subsequent platform read.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_clipboard.rs#L92)

<a id="function-copy_to_clipboard_async"></a>

### copy_to_clipboard_async

```rust
fn copy_to_clipboard_async(self: &Self, clipboard: Rc<dyn IClipboard>) -> LocalBoxFuture<Result<(), ClipboardError>>
```

Copies the captured range as exact in-process content, representable RTF,
and plain text. Copy never changes the editor's selection, composition or
undo history; a degenerate range leaves the clipboard unchanged.

The immutable fragment is captured when this method is called. The
clipboard owns the outgoing transfer once `set_data_async` is invoked.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_clipboard.rs#L106)

<a id="function-cut_to_clipboard_async"></a>

### cut_to_clipboard_async

```rust
fn cut_to_clipboard_async(self: &Self, clipboard: Rc<dyn IClipboard>) -> LocalBoxFuture<Result<(), ClipboardError>>
```

Copies this independent range, then deletes precisely that captured
target after the clipboard write succeeds. Later edits, range changes,
selection requests, or IME sessions cancel the pending deletion.

On its first poll, a nonempty cut follows the editor's ordinary edit
policy and cancels an existing preview before capturing committed text.
A failed clipboard write leaves that committed text and history intact;
it does not restart the canceled preview. An empty cut has no side effects.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_clipboard.rs#L127)

<a id="function-paste_from_clipboard_async"></a>

### paste_from_clipboard_async

```rust
fn paste_from_clipboard_async(self: &Self, clipboard: Rc<dyn IClipboard>, format: RichTextPasteFormat) -> LocalBoxFuture<Result<(), ClipboardError>>
```

Replaces this independent range using exactly the requested clipboard
format policy. A successful edit preserves and rebases the editor's
directed selection and creates one undo unit.

Missing/empty data, invalid payloads, platform errors and stale requests
do not cancel IME or change the target. After a valid payload arrives, an
original preview is canceled and the live committed endpoints are read
again. Plain text inherits insertion formatting; rich fragments keep
their assigned formatting and structure.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_clipboard.rs#L163)

<a id="function-gravity"></a>

### gravity

```rust
fn gravity(self: &Self) -> RangeGravity
```

Reads this independent range's accepted formatting affinity.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_range_gravity.rs#L88)

<a id="function-set_gravity"></a>

### set_gravity

```rust
fn set_gravity(self: &Self, gravity: RangeGravity)
```

Changes range metadata without changing text, selection, composition or
undo/redo. Rust Clone shares this setting; get_clone() starts with UIBehavior.
Endpoint setters retain it. Successful text undo leaves the current mode.

A real mode change retires pending asynchronous range operations, even
when a later setter returns to the original mode. Outward is accepted as
UIBehavior, matching the measured native setter readback.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_range_gravity.rs#L99)

<a id="function-set_gravity_value"></a>

### set_gravity_value

```rust
fn set_gravity_value(self: &Self, value: i32) -> Result<(), EditError>
```

Checked numeric boundary for native/serialized values. Invalid values
leave all state untouched; the typed setter cannot receive them.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_range_gravity.rs#L110)

<a id="function-document"></a>

### document

```rust
fn document(self: &Self) -> RichTextDocument
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L487)

<a id="function-start_position"></a>

### start_position

```rust
fn start_position(self: &Self) -> usize
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L494)

<a id="function-end_position"></a>

### end_position

```rust
fn end_position(self: &Self) -> usize
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L497)

<a id="function-range"></a>

### range

```rust
fn range(self: &Self) -> Range<usize>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L500)

<a id="function-length"></a>

### length

```rust
fn length(self: &Self) -> usize
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L503)

<a id="function-story_length"></a>

### story_length

```rust
fn story_length(self: &Self) -> usize
```

Length of the single story in FerroUI's UTF-16 model coordinates. As with
the range endpoints, this excludes the synthetic terminal mark emitted by
complete-document text retrieval.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L509)

<a id="function-is_degenerate"></a>

### is_degenerate

```rust
fn is_degenerate(self: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L512)

<a id="function-text"></a>

### text

```rust
fn text(self: &Self) -> Result<String, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L515)

<a id="function-get_text"></a>

### get_text

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L519)

<a id="function-snapshot"></a>

### snapshot

```rust
fn snapshot(self: &Self) -> Result<DocumentSnapshot, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L541)

<a id="function-get_rectangles"></a>

### get_rectangles

```rust
fn get_rectangles(self: &Self, view: &RichTextBlock) -> Result<Vec<Rect>, EditError>
```

Returns one rectangle for each visual fragment, including bidirectional and wrapped text.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L570)

<a id="function-get_clone"></a>

### get_clone

```rust
fn get_clone(self: &Self) -> Result<Self, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L574)

<a id="function-formatted_text"></a>

### formatted_text

```rust
fn formatted_text(self: &Self) -> Result<Self, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L593)

<a id="function-set_formatted_text"></a>

### set_formatted_text

```rust
fn set_formatted_text(self: &Self, value: &Self) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L597)

<a id="function-set_start_position"></a>

### set_start_position

```rust
fn set_start_position(self: &Self, position: usize) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L602)

<a id="function-set_end_position"></a>

### set_end_position

```rust
fn set_end_position(self: &Self, position: usize) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L606)

<a id="function-set_range"></a>

### set_range

```rust
fn set_range(self: &Self, start: usize, end: usize) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L609)

<a id="function-collapse"></a>

### collapse

```rust
fn collapse(self: &Self, to_start: bool) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L625)

<a id="function-select"></a>

### select

```rust
fn select(self: &Self) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L633)

<a id="function-in_range"></a>

### in_range

```rust
fn in_range(self: &Self, other: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L638)

<a id="function-is_equal"></a>

### is_equal

```rust
fn is_equal(self: &Self, other: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L643)

<a id="function-in_story"></a>

### in_story

```rust
fn in_story(self: &Self, other: &Self) -> bool
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L647)

<a id="function-match_selection"></a>

### match_selection

```rust
fn match_selection(self: &Self) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L651)

<a id="function-get_character_utf32"></a>

### get_character_utf32

```rust
fn get_character_utf32(self: &Self, offset: i32) -> u32
```

Decodes the scalar at a signed UTF-16 offset from the range's end. Either
half of a surrogate pair returns its scalar; outside the story returns zero.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L658)

<a id="function-set_text"></a>

### set_text

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

Replaces the range while preserving and rebasing the editor's independent selection.
The change, formatting, and selection are one undoable transaction.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L676)

<a id="function-set_text_with_options"></a>

### set_text_with_options

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



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L741)

<a id="function-set_snapshot"></a>

### set_snapshot

```rust
fn set_snapshot(self: &Self, snapshot: &DocumentSnapshot) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L826)

<a id="function-set_character_format"></a>

### set_character_format

```rust
fn set_character_format(self: &Self, format: &CharacterFormat) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L942)

<a id="function-set_paragraph_format"></a>

### set_paragraph_format

```rust
fn set_paragraph_format(self: &Self, format: &ParagraphFormat) -> Result<(), EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L954)

<a id="function-character_format"></a>

### character_format

```rust
fn character_format(self: &Self) -> Result<TextFormatValue<CharacterFormat>, EditError>
```

Queries effective formats at run boundaries, so a long uniform run is inspected once.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L960)

<a id="function-paragraph_format"></a>

### paragraph_format

```rust
fn paragraph_format(self: &Self) -> Result<TextFormatValue<ParagraphFormat>, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L998)

<a id="function-expand"></a>

### expand

```rust
fn expand(self: &Self, unit: TextRangeUnit) -> Result<usize, EditError>
```

Expands to the smallest whole TOM units containing the range. Whole-word
search retains independent Unicode boundaries and excludes trailing blanks.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1028)

<a id="function-start_of"></a>

### start_of

```rust
fn start_of(self: &Self, unit: TextRangeUnit, extend: bool) -> Result<isize, EditError>
```

Moves to the beginning of the first overlapping unit. Extension changes
only the start; otherwise the range collapses. The signed UTF-16 displacement
is always nonpositive, including zero when already on a unit boundary.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1039)

<a id="function-end_of"></a>

### end_of

```rust
fn end_of(self: &Self, unit: TextRangeUnit, extend: bool) -> Result<isize, EditError>
```

Moves to the end of the last overlapping unit. A collapse contributes one
to the returned UTF-16 displacement, matching the native EndOf contract.
The synthetic final-CR case is outside FerroUI's range coordinates.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1051)

<a id="function-get_index"></a>

### get_index

```rust
fn get_index(self: &Self, unit: TextRangeUnit) -> Result<usize, EditError>
```

Gets the one-based story index at StartPosition. At the end of a story it
reports the total unit count; a unit absent from empty content has index zero.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1066)

<a id="function-set_index"></a>

### set_index

```rust
fn set_index(self: &Self, unit: TextRangeUnit, index: i32, extend: bool) -> Result<(), EditError>
```

Relocates to a whole unit (extend) or its starting insertion point. Positive
indices count from one; negative indices count back from the last unit.
Zero and out-of-range indices fail without changing the live range.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1073)

<a id="function-move_by"></a>

### move_by

```rust
fn move_by(self: &Self, unit: TextRangeUnit, count: i32) -> Result<i32, EditError>
```

A non-degenerate range first collapses toward the movement direction and
reaches the nearest unit boundary. That collapse counts as the first unit.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1086)

<a id="function-move_start"></a>

### move_start

```rust
fn move_start(self: &Self, unit: TextRangeUnit, count: i32) -> Result<i32, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1095)

<a id="function-move_end"></a>

### move_end

```rust
fn move_end(self: &Self, unit: TextRangeUnit, count: i32) -> Result<i32, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1104)

<a id="function-find"></a>

### find

```rust
fn find(self: &Self, text: &str, options: TextFindOptions) -> Result<Option<Self>, EditError>
```

Searches this range. Case-insensitive matching uses Unicode lowercase mappings;
UTF-16 offsets remain exact even when a character maps to several lowercase scalars.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1116)

<a id="function-find_text"></a>

### find_text

```rust
fn find_text(self: &Self, text: &str, options: TextFindOptions) -> Result<bool, EditError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1165)

<a id="function-find_text_with_length"></a>

### find_text_with_length

```rust
fn find_text_with_length(self: &Self, text: &str, scan_length: i32, options: FindOptions) -> Result<usize, EditError>
```

Native bounded search: positive lengths start at StartPosition, negative
lengths search backward from EndPosition. Zero searches the existing range,
or the remaining story for a caret. A repeat skips the range already found.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/rich_text/rich_edit_text_document.rs#L1176)

## 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`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `ErasedDestructor`
- `IntoEither`
- `Clone`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
