diff --git a/source/NVDAObjects/window/edit.py b/source/NVDAObjects/window/edit.py index d2c513e33ff..e4b20cea97c 100644 --- a/source/NVDAObjects/window/edit.py +++ b/source/NVDAObjects/window/edit.py @@ -34,6 +34,7 @@ import watchdog import locationHelper import textUtils +from comInterfaces._8CC497C9_A1DF_11CE_8098_00AA0047BE5D_0_1_0 import tomSelStartActive selOffsetsAtLastCaretEvent=None @@ -718,7 +719,11 @@ def __init__(self,obj,position,_rangeObj=None): self._rangeObj=self.obj.ITextSelectionObject.duplicate elif position==textInfos.POSITION_CARET: self._rangeObj=self.obj.ITextSelectionObject.duplicate - self._rangeObj.Collapse(True) + startActive: bool = (self.obj.ITextSelectionObject.Flags & tomSelStartActive) > 0 + # Notice: in the following line Collapse() method is called on ITextRange object, not on TextInfo. + # It's boolean argument has the opposite meaning from the one in TextInfo: + # True means collapse to the start, while False means collapse to the end + self._rangeObj.Collapse(startActive) elif position==textInfos.POSITION_FIRST: self._rangeObj=self.obj.ITextDocumentObject.range(0,0) elif position==textInfos.POSITION_LAST: