Trait kas_text::format::EditableText [−][src]
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
fn set_string(&mut self, string: String)
fn set_string(&mut self, string: String)
Set unformatted text
Existing contents and formatting are replaced entirely.
fn 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).
fn 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
fn 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.