Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.2
-
None
-
Windows desktop
Description
When calling select(0, 0) in TextInput, it does not alter the cursor position. If you do the same with TextEdit it sets the cursor to position 0. This is a minor issue, but I would expect consistent behavior between these components unless otherwise documented.
My recommendation would be not to move the cursor since I believe there's no other way to clear a selection programmatically, and not repositioning the cursor in this case prevents slightly annoying UI behavior in such case, especially when some kind of a "ensureCursorVisible" functionality is used for keeping the cursor visible.
When doing actual selection (e.g. select(10, 11)) both editors move the cursor to the end of selection.
Here's the outcome of the test snippet I attach to this report:
TEXTINPUT CASE 1:
TextInput initial cursor position:20
TextInput cursor position after selection:11
TEXTINPUT CASE 2:
TextInput initial cursor position:20
TextInput cursor position after empty selection:20
TEXTEDIT CASE 1:
TextEdit initial cursor position:20
TextEdit cursor position after selection:11
TEXTEDIT CASE 2:
TextEdit initial cursor position:20
TextEdit cursor position after empty selection:0