OSDN Git Service

Implementation of #123 (quick nav scripts to jump to the start, or past the end,...
authorMichael Curran <mick@kulgan.net>
Wed, 25 Apr 2012 07:01:11 +0000 (17:01 +1000)
committerMichael Curran <mick@kulgan.net>
Wed, 25 Apr 2012 07:01:11 +0000 (17:01 +1000)
source/virtualBuffers/__init__.py
user_docs/en/changes.t2t
user_docs/en/userGuide.t2t

index a16a98b..e5c125a 100644 (file)
@@ -1341,6 +1341,54 @@ class VirtualBuffer(cursorManager.CursorManager, treeInterceptorHandler.TreeInte
                # 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
@@ -1356,6 +1404,8 @@ class VirtualBuffer(cursorManager.CursorManager, treeInterceptorHandler.TreeInte
                "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
index 3cf2359..58e49d0 100644 (file)
@@ -8,6 +8,7 @@
 == New Features ==\r
 - NVDA can now automatically check for, download and install updates. (#73)\r
 - Many more common NVDA features now work in Windows 8 Metro style apps when using an installed release  of NVDA, including speaking of typed characters, and browse mode for web documents (includes support for metro version of Internet Explorer 10). Portable copies of NVDA cannot access metro style apps. (#1801) \r
+- In browse mode documents (Internet Explorer, Firefox etc) you can now  jump to the start, or past the end, of certain containing elements (including lists and tables) with "kb:shift+," and "kb:shift+." respectivly.\r
 \r
 \r
 == Changes ==\r
index 72cab22..cbb839a 100644 (file)
@@ -411,6 +411,10 @@ The following keys by themselves jump to the next available element, while addin
 - o: embedded object\r
 - 1 to 6: headings at levels 1 to 6 respectively\r
 -\r
+To move to the beginning or end of containing elements such as lists and tables:\r
+|| Name | Key | Description |\r
+| Move to start of container | shift+, | Moves to the start of the container (list, table etc) where the caret is positiond |\r
+| Move past end of container | shift+. | Moves past the end of the container (list, table etc) where the caret is positiond |\r
 %kc:endInclude\r
 \r
 ++ The Elements List ++\r