mirror of
https://github.com/servo/servo
synced 2026-05-11 17:37:21 +02:00
`TextInput` internally stores a rope of text content, one segment for each line. This change separates out the rope into a separate `Rope` data structure that can be shared with other parts of Servo. `TextInput` needs to move through text content in a variety of ways, depending on the keys pressed when interacting with a text area. This change provides a unified movement API in both `Rope` and in `TextInput` ensuring that selection is handled consistently (apart from a few minor quirks [^1]). This simplifies the code an improves interactive behavior. [^1]: One of these quirks is that the edit point will move to directional end of the motion when collapsing a selection, but only when moving by grapheme or word (and not by line). These quirks existed in an undocumented way previously and they are preserved with code comments. Testing: This is covered by existing unit tests (updated for the new API) and the WPT suite. Signed-off-by: Martin Robinson <mrobinson@igalia.com>