For example, if textWidget.value is "foobar" and the user selects the whole thing (from left to right), then when textWidget.value is set to "foo" (programatically, not by the user), the end of the selection range will extend past the end of the text. If the user hits the left arrow key at this point, an error is thrown.
Either the selection range should never be allowed to extend past EOT (clamp it in onChange), or it should be clamped to the text length when modifying it (clamp it in a bunch of internal functions).
For example, if
textWidget.value
is "foobar" and the user selects the whole thing (from left to right), then whentextWidget.value
is set to "foo" (programatically, not by the user), the end of the selection range will extend past the end of the text. If the user hits the left arrow key at this point, an error is thrown.Either the selection range should never be allowed to extend past EOT (clamp it in onChange), or it should be clamped to the text length when modifying it (clamp it in a bunch of internal functions).