pub enum EditKind {
Typing {
boundary: bool,
},
Deleting,
Composing,
Chunk,
}Expand description
What sort of change a keystroke made — the unit undo steps back by.
Variants§
Typing
One character typed. boundary is a character that ends a word, which joins the
run it is the end of and closes it.
Deleting
A backspace or a forward delete, with nothing selected.
Composing
A revision of the text an input method is still composing.
Chunk
A paste, a cut, a selection replaced, a line break: one deliberate act, one step.
Implementations§
Source§impl EditKind
impl EditKind
Sourcepub fn of(key: &Key, selected: bool, composing: bool) -> Self
pub fn of(key: &Key, selected: bool, composing: bool) -> Self
Reads a keystroke as one of the four, given what the field was in when it arrived: whether something was selected, and whether an input method was composing.
The two conditions are the reason this is not a match on the key alone. A backspace with a selection removes a passage and is a chunk; the same backspace with no selection removes a letter and joins the run. Typing with a selection replaces it, which is the case the issue names — a whole selection replaced by one character is one step, and the step has to include what was replaced.