pub trait EditableText: FormattableText {
fn set_string(&mut self, string: String);
fn insert_char(&mut self, index: usize, c: char);
fn replace_range(&mut self, range: Range<usize>, replace_with: &str);
fn swap_string(&mut self, string: &mut String) { ... }
}Expand description
Extension of FormattableText allowing editing
Required Methods
sourcefn set_string(&mut self, string: String)
fn set_string(&mut self, string: String)
Set unformatted text
Existing contents and formatting are replaced entirely.
sourcefn insert_char(&mut self, index: usize, c: char)
fn insert_char(&mut self, index: usize, c: char)
Insert a char at the given position
Formatting is adjusted such that it still affects the same chars (i.e.
all formatting after index is postponed by the length of the char).
sourcefn replace_range(&mut self, range: Range<usize>, replace_with: &str)
fn replace_range(&mut self, range: Range<usize>, replace_with: &str)
Replace text at range with replace_with
Formatting is adjusted such that it still affects the same chars.
Provided Methods
sourcefn swap_string(&mut self, string: &mut String)
fn swap_string(&mut self, string: &mut String)
Swap the contiguous unformatted text with another string
Any formatting present is removed.