pub fn last_chord_token_byte_len(text: &str) -> usizeExpand description
Number of bytes the last chord token occupies at the end of
text, treating it as a sequence of chord tokens (one chord
per logical keypress). Used by chord-capture’s backspace
handler to remove a whole token instead of a single char.
A token is either:
- A
<…>group (matched balanced angle brackets). - A single character.
Returns 0 if text is empty.
§Examples
use lattice_protocol::last_chord_token_byte_len;
assert_eq!(last_chord_token_byte_len("gg<C-w>"), 5); // "<C-w>"
assert_eq!(last_chord_token_byte_len("<C-w>é"), 2); // one 2-byte char
assert_eq!(last_chord_token_byte_len(""), 0);