Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Edit.makeTextInfo(caret) when selection is present #16455

Merged
merged 1 commit into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion source/NVDAObjects/window/edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,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 & comInterfaces.tom.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:
Expand Down