Bug 132357

Summary: Opening-/closing-tag update does not work properly
Product: [Unmaintained] quanta Reporter: twerner
Component: generalAssignee: András Manţia <amantia>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description twerner 2006-08-13 20:36:12 UTC
Version:           3.5.4 (using KDE KDE 3.5.1)
Installed from:    SuSE RPMs
OS:                Linux

Given following XML-excerpt:

        <entry id="color" label="%color" type="selection">
            <selection type="dropdown">
                <entry label="%brown" value="%brown"/>
                <entry label="%green" value="%green"/>
            </selection>
        </entry>

I experience following problem with "opening/closing tag update" turned on:

I try to change the code above into:

        <entry id="color" label="%color" type="selection">
            <selection type="dropdown">
                <option label="%brown" value="%brown"/>
                <option label="%green" value="%green"/>
            </selection>
        </entry>

After saving the file, Quanta decides to apply following change

        <entry id="color" label="%color" type="selection">
            <selection type="dropdown">
                <option label="%brown" value="%brown"/>
                <option label="%green" value="%green"/>
            </selection>
        </option>

It does not seem to recognize the tag nesting properly.
Comment 1 András Manţia 2006-09-08 15:21:43 UTC
SVN commit 582175 by amantia:

Fix automatic updating of closing tags (don't search for the closing tag for single tags). 

BUG: 132357

 M  +1 -0      ChangeLog  
 M  +6 -4      src/document.cpp  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #582174:582175
@@ -17,6 +17,7 @@
       - respect the order of items in the .docrc [#133704]
       - fix crash when creating project through slow links [#133705]
       - really abort if a remote directory cannot be created [#117032]
+      - fix automatic updating of closing tags [#132357]
 
 
 Version 3.5.4 (Release date: 02-08-2006; Started 24-06-2005):
--- branches/KDE/3.5/kdewebdev/quanta/src/document.cpp #582174:582175
@@ -2296,7 +2296,9 @@
       viewCursorIf->cursorPositionReal(&line, &column);
       node = parser->nodeAt(line, column, false);
       if (node &&
-          (node->tag->type==Tag::XmlTag || node->tag->type == Tag::XmlTagEnd) )
+          ((node->tag->type == Tag::XmlTag && !node->tag->single) ||
+            node->tag->type == Tag::XmlTagEnd)
+           )
       {
         Tag *tag;
         tag = new Tag(*node->tag);
@@ -2322,7 +2324,7 @@
       node = parser->nodeAt(line, column, false);
       if (node &&
           node->tag->nameSpace + node->tag->name != currentNode->tag->nameSpace + currentNode->tag->name &&
-          (node->tag->type == Tag::XmlTag || node->tag->type == Tag::XmlTagEnd) && node->tag->validXMLTag)
+          ((node->tag->type == Tag::XmlTag && !node->tag->single) || node->tag->type == Tag::XmlTagEnd) && node->tag->validXMLTag)
       {
         int bl, bc, bl2, bc2;
         node->tag->beginPos(bl, bc);
@@ -2339,7 +2341,7 @@
           previousNode = 0L;
         }
         if (bl == bl2 && bc == bc2 &&
-           (currentNode->tag->type == Tag::XmlTag || currentNode->tag->type == Tag::XmlTagEnd))
+           ((node->tag->type == Tag::XmlTag && !node->tag->single) || currentNode->tag->type == Tag::XmlTagEnd))
         {
           QString newName = node->tag->name;
           bool updateClosing = (currentNode->tag->type == Tag::XmlTag) && !newName.startsWith("!");
@@ -2352,7 +2354,7 @@
             node = node->previousSibling();
           while (node)
           {
-            if (node->tag->validXMLTag && (node->tag->type == Tag::XmlTag || node->tag->type == Tag::XmlTagEnd))
+            if (node->tag->validXMLTag && ((node->tag->type == Tag::XmlTag && !node->tag->single) || node->tag->type == Tag::XmlTagEnd))
             {
               if (node->tag->nameSpace + node->tag->name == currentNode->tag->nameSpace + currentNode->tag->name )
               {