# We do this check because we don't want to remember caret positions for email messages, etc.\r
return isinstance(docConstId, basestring) and docConstId.split("://", 1)[0] in ("http", "https", "ftp", "ftps", "file")\r
\r
+ def getEnclosingContainerRange(self,range):\r
+ controlFields=[]\r
+ for cmd in range.getTextWithFields():\r
+ if not isinstance(cmd,textInfos.FieldCommand) or cmd.command!="controlStart":\r
+ break\r
+ controlFields.append(cmd.field)\r
+ containerField=None\r
+ while controlFields:\r
+ field=controlFields.pop()\r
+ if field.getPresentationCategory(controlFields,config.conf['documentFormatting'])==field.PRESCAT_CONTAINER:\r
+ containerField=field\r
+ break\r
+ if not containerField: return None\r
+ docHandle=int(containerField['controlIdentifier_docHandle'])\r
+ ID=int(containerField['controlIdentifier_ID'])\r
+ offsets=range._getOffsetsFromFieldIdentifier(docHandle,ID)\r
+ return self.makeTextInfo(textInfos.offsets.Offsets(*offsets))\r
+\r
+ def script_moveToStartOfContainer(self,gesture):\r
+ info=self.makeTextInfo(textInfos.POSITION_CARET)\r
+ info.expand(textInfos.UNIT_CHARACTER)\r
+ container=self.getEnclosingContainerRange(info)\r
+ if not container:\r
+ # Translaters: No containing element (list, table etc) to move to start or end of \r
+ ui.message(_("Not in a container"))\r
+ return\r
+ container.collapse()\r
+ self._set_selection(container, reason=self.REASON_QUICKNAV)\r
+ container.expand(textInfos.UNIT_LINE)\r
+ speech.speakTextInfo(container, reason=controlTypes.REASON_FOCUS)\r
+ # Translaters: description for the moveToStartOfContainer script for virtual buffers\r
+ script_moveToStartOfContainer.__doc__=_("Moves to the start of the container element, such as a list or table")\r
+\r
+ def script_movePastEndOfContainer(self,gesture):\r
+ info=self.makeTextInfo(textInfos.POSITION_CARET)\r
+ info.expand(textInfos.UNIT_CHARACTER)\r
+ container=self.getEnclosingContainerRange(info)\r
+ if not container:\r
+ # Translaters: No containing element (list, table etc) to move to start or end of \r
+ ui.message(_("Not in a container"))\r
+ return\r
+ container.collapse(end=True)\r
+ self._set_selection(container, reason=self.REASON_QUICKNAV)\r
+ container.expand(textInfos.UNIT_LINE)\r
+ speech.speakTextInfo(container, reason=controlTypes.REASON_FOCUS)\r
+ # Translaters: description for the movePastEndOfContainer script for virtual buffers\r
+ script_movePastEndOfContainer.__doc__=_("Moves past the end of the container element, such as a list or table")\r
+\r
__gestures = {\r
"kb:enter": "activatePosition",\r
"kb:space": "activatePosition",\r
"kb:control+alt+upArrow": "previousRow",\r
"kb:control+alt+rightArrow": "nextColumn",\r
"kb:control+alt+leftArrow": "previousColumn",\r
+ "kb:shift+,": "moveToStartOfContainer",\r
+ "kb:shift+.": "movePastEndOfContainer",\r
}\r
\r
# Add quick navigation scripts.\r