Fix exception during textInfos.moveToCodepointOffset when some characters correspond to 0 pythonic characters#16447
Conversation
…ters correspond to 0 pythonic characters
|
@mltony Could you please look into the following issue, which seems related? Still reproducible wit this pr? In word, type: Then Is this expected behavior, or should the function for values 1, 2 and 3 just return the collapsed start of the textInfo? |
|
@LeonarddeR, |
Link to issue number:
Partially closes #16406.
Summary of the issue:
When trying to navigate by style an exception is thrown:
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:
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
moveToCodepointOffsetfunction, so I missed one edge case. Now fixing this edge case. Also adding unit tests.Testing strategy:
Unit test.
Tested on test case from the original issue with UIA enabled.
Known issues with pull request:
N/A
Code Review Checklist: