OSDN Git Service

Improve the presentation of non-screen layout in virtualBuffers a little by only...
authorMichael Curran <mick@kulgan.net>
Wed, 6 Oct 2010 00:47:54 +0000 (11:47 +1100)
committerMichael Curran <mick@kulgan.net>
Wed, 6 Oct 2010 00:47:54 +0000 (11:47 +1100)
Specific changes:
*VBufStorage getLineOffsets: when traversing forward through nodes, always limit to the closest ancestor block node, even if useScreenLayout is False. Previously if useScreenLayout was false, it would limit to the closest control field.  This change means that the end of a line in reference to a given character will no longer be guaranteed to be at the end of the current controlField, but instead anywhere between the current character, the beginning of the next controlField, or the end of the current block.
  *VBufStorage getLineOffsets: when traversing backwards through nodes, no longer stop if the next node we get to is a controlFieldNode, if useScreenLayout is false. Instead, always only stop on the next node if its a block node. Also, when useScreenLayout is false and when actually finding the next nodein the traversal, limit to the current traversal node's parent, meaning that it will never give back a node that is outside the closest ancestry controlFieldNode for the current traversal node. Previously with useScreenLayout being false, it would limit to the closest ancestry controlField at the position of the given character, which in some cases may be higher in the ancestry than the current traversal node's closest ancestry controlField node. These changes mean that the start of the line in reference to the given character will no longer be guaranteed to be at the start of the closest controlField. Instead, it will be anywhere between the given character, the beginning (left side) of a previous controlField, or the beginning of the closest ancestry block node.

source/NVDAHelper/vbufBase/storage.cpp

index 5a21524..872ed3b 100644 (file)
@@ -938,13 +938,8 @@ bool VBufStorage_buffer_t::getLineOffsets(int offset, int maxLineLength, bool us
        DEBUG_MSG(L"Starting at node "<<initNode->getDebugInfo());\r
        std::set<int> possibleBreaks;\r
        //Find the node at which to limit the search for line endings.\r
-       VBufStorage_fieldNode_t* limitNode=NULL;\r
-       if(useScreenLayout) {\r
-               for(limitNode=initNode->parent;limitNode!=NULL&&!limitNode->isBlock;limitNode=limitNode->parent);\r
-       } else {\r
-               limitNode=initNode->parent;\r
-       }\r
-       DEBUG_MSG(L"limit node is "<<limitNode->getDebugInfo());\r
+       VBufStorage_fieldNode_t* limitBlockNode=NULL;\r
+       for(limitBlockNode=initNode->parent;limitBlockNode!=NULL&&!limitBlockNode->isBlock;limitBlockNode=limitBlockNode->parent);\r
        //Some needed variables for searching back and forward\r
        VBufStorage_fieldNode_t* node=NULL;\r
        int relative, bufferStart, bufferEnd, tempRelativeStart;\r
@@ -986,7 +981,7 @@ bool VBufStorage_buffer_t::getLineOffsets(int offset, int maxLineLength, bool us
                        }\r
                }\r
                //Move on to the next node.\r
-               node = node->nextNodeInTree(TREEDIRECTION_FORWARD,limitNode,&tempRelativeStart);\r
+               node = node->nextNodeInTree(TREEDIRECTION_FORWARD,limitBlockNode,&tempRelativeStart);\r
                //If not using screen layout, make sure not to pass in to another control field node\r
                if(node&&((!useScreenLayout&&node->firstChild)||node->isBlock)) {\r
                        node=NULL;\r
@@ -1035,9 +1030,9 @@ bool VBufStorage_buffer_t::getLineOffsets(int offset, int maxLineLength, bool us
                        }\r
                }\r
                //Move on to the previous node.\r
-               node = node->nextNodeInTree(TREEDIRECTION_SYMMETRICAL_BACK,limitNode,&tempRelativeStart);\r
+               node = node->nextNodeInTree(TREEDIRECTION_SYMMETRICAL_BACK,useScreenLayout?limitBlockNode:node->parent,&tempRelativeStart);\r
                //If not using screen layout, make sure not to pass in to another control field node\r
-               if(node&&((!useScreenLayout&&node->firstChild)||node->isBlock)) {\r
+               if(node&&node->isBlock) {\r
                        node=NULL;\r
                }\r
                if(node) {\r