Skip to content
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
14 changes: 8 additions & 6 deletions source/compoundDocuments.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _isNamedlinkDestination(self, obj: NVDAObject) -> bool:
and controlTypes.State.LINKED not in obj.states
)

def _getControlFieldForObject(self, obj, ignoreEditableText=True):
def _getControlFieldForObject(self, obj: NVDAObject, ignoreEditableText=True):
if ignoreEditableText and self._isObjectEditableText(obj):
# This is basically just a text node.
return None
Expand Down Expand Up @@ -290,16 +290,18 @@ def getTextWithFields(self, formatConfig=None):
embedIndex = self._getFirstEmbedIndex(ti)
else:
embedIndex += 1
field = ti.obj.getChild(embedIndex)
controlField = self._getControlFieldForObject(field, ignoreEditableText=False)
controlField["content"] = field.name
childObject: NVDAObject = ti.obj.getChild(embedIndex)
controlField = self._getControlFieldForObject(childObject, ignoreEditableText=False)
controlField["content"] = childObject.name
fields.extend((
textInfos.FieldCommand("controlStart", controlField),
textUtils.OBJ_REPLACEMENT_CHAR,
textInfos.FieldCommand("controlEnd", None)
))
else:
fields.append(field)
else: # str or fieldCommand
if not isinstance(textWithEmbeddedObjectsItem, (str, textInfos.FieldCommand)):
log.error(f"Unexpected type: {textWithEmbeddedObjectsItem!r}")
fields.append(textWithEmbeddedObjectsItem)
return fields

def _findNextContent(self, origin, moveBack=False):
Expand Down