Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Various fixes in CompoundTextInfo and MozillaCompoundTextInfo:
* Fix CompoundTextInfo.__eq__ when comparing against TextInfos of other types.
* Fix MozillaCompoundTextInfo.move for backwards movement.
* Fix off-by-one error in CompoundTextInfo which broke CursorManager selection across embedded objects.
  • Loading branch information
jcsteh committed Dec 13, 2016
commit e5bf6bcb60e32f174ed346bc6ba9fd90157222f5
5 changes: 4 additions & 1 deletion source/NVDAObjects/IAccessible/ia2TextMozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,10 @@ def move(self, unit, direction, endPoint=None):
# Find the edge of the current unit in the requested direction.
moveTi, moveObj = self._findUnitEndpoints(moveTi, unit, findStart=moveBack, findEnd=not moveBack)

if not moveBack:
if moveBack:
# Collapse to the start of the previous unit.
moveTi.collapse()
else:
# Collapse to the start of the next unit.
moveTi.collapse(end=True)
if moveTi.compareEndPoints(self._makeRawTextInfo(moveObj, textInfos.POSITION_ALL), "endToEnd") == 0:
Expand Down
8 changes: 7 additions & 1 deletion source/compoundDocuments.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def _normalizeStartAndEnd(self):
# Aside from being pointless, we don't want a collapsed end object, as this will cause bogus control fields to be emitted.
try:
self._end, self._endObj = self._findNextContent(self._endObj, moveBack=True)
self._end.move(textInfos.UNIT_OFFSET, 1)
# _end is now on the last character, but we want it collapsed after this.
self._end.move(textInfos.UNIT_OFFSET, 1, endPoint="end")
self._end.collapse(end=True)
except LookupError:
pass

Expand Down Expand Up @@ -152,6 +154,10 @@ def _getControlFieldForObject(self, obj, ignoreEditableText=True):
return field

def __eq__(self, other):
if self is other:
return True
if type(self) is not type(other):
return False
return self._start == other._start and self._startObj == other._startObj and self._end == other._end and self._endObj == other._endObj

def __ne__(self, other):
Expand Down