You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Works around a UIA bug on Windows 10 1803 and later that means we can not trust
173
+
the "end" endpoint of a collapsed (empty) text range for comparisons.
174
+
"""
175
+
selfEndPoint, otherEndPoint=which.split("To")
176
+
# In this case, there is no need to check if self is collapsed
177
+
# since the point of this method is to change its text range, modifying the "end" endpoint of a collapsed
178
+
# text range is fine.
179
+
ifotherEndPoint=="End"andnotother._isCollapsed:
180
+
otherEndPoint="Start"
181
+
which=f"{selfEndPoint}To{otherEndPoint}"
182
+
returnsuper().setEndPoint(other, which=which)
183
+
184
+
def_get__isCollapsed(self):
185
+
"""Works around a UIA bug on Windows 10 1803 and later that means we can not trust the "end" endpoint of a collapsed (empty) text range for comparisons.
186
+
Instead we check to see if we can get the first character from the text range. A collapsed range will not have any characters and will return an empty string."""
163
187
returnnotbool(self._rangeObj.getText(1))
164
188
189
+
def_get_isCollapsed(self):
190
+
# To decide if the textRange is collapsed,
191
+
# Check if it has no text.
192
+
returnself._isCollapsed
193
+
165
194
def_getCurrentOffsetInThisLine(self, lineInfo):
166
195
"""
167
196
Given a caret textInfo expanded to line, returns the index into the
0 commit comments