Fix exception during textInfos.moveToCodepointOffset when some characters correspond to 0 pythonic characters (#16447)
Partially closes #16406.
Summary of the issue:
When trying to navigate by style an exception is thrown:
RuntimeError: Unable to find desired offset in TextInfo.
Description of user facing changes
N/A
Description of development approach
Investigation showed that in Outlook with word UIA enabled, sometimes there are characters that translate into 0 codepoint characters. To illustrate this further:
>>> p=focus.treeInterceptor.makeTextInfo('caret')
>>> p.expand('paragraph')
>>> p.text
'View in browser'
>>> p.collapse(end=True)
>>> p.move('character', -1, 'start')
-1
>>> p.text
''
>>> len(p.text)
0
E.g. we move a collapsed text info start by -1 character, and the resulting textInfo still appears to be empty- at least its Python text is empty.
I anticipated this to happen somewhere, but didn't encounter a single example when I was implementing moveToCodepointOffset function, so I missed one edge case. Now fixing this edge case. Also adding unit tests.