OSDN Git Service

MS Word TextInfo's move method: when the range is on the last offset in the document...
authorMichael Curran <mick@kulgan.net>
Fri, 1 Jul 2011 03:35:13 +0000 (13:35 +1000)
committerMichael Curran <mick@kulgan.net>
Fri, 1 Jul 2011 03:35:13 +0000 (13:35 +1000)
source/NVDAObjects/window/winword.py

index d4769eb..74d1f36 100755 (executable)
@@ -294,6 +294,11 @@ class WordDocumentTextInfo(textInfos.TextInfo):
                else:\r
                        moveFunc=self._rangeObj.Move\r
                res=moveFunc(unit,direction)\r
+               #units higher than character and word expand to contain the last text plus the insertion point offset in the document\r
+               #However move from a character before will incorrectly move to this offset which makes move/expand contridictory to each other\r
+               #Make sure that move fails if it lands on the final offset but the unit is bigger than character/word\r
+               if direction>0 and unit not in (wdCharacter,wdWord)  and (self._rangeObj.start+1)==self.obj.WinwordDocumentObject.characters.count:\r
+                       return 0\r
                return res\r
 \r
        def _get_bookmark(self):\r