text cursor position is preserved when using <Tab> to switch between controls so the commands should work on controls without focus, too
instead of setting and getting just the text cursor position (as number), an array [from, to] could be used to get/set the start/end-position of selected text, too
e.g.
[0,1] - element 0 selected
[1,1] - no selection, cursor between element 0 and 1
[0,2] - element 0 and 1 selected
...
nowadays with the extended select syntax (... select [from, length])
an array in the form [from, length] would be more suitable to get/set the selection position
e.g.
[0,1] - element 0 selected
[1,0] - no selection, cursor between element 0 and 1
[1,2] - element 1 and 2 selected
...