Bug 71104 - single xhtml tag not properly closed when editing tag using new GUI tag editor
Summary: single xhtml tag not properly closed when editing tag using new GUI tag editor
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-23 12:06 UTC by Damon Lynch
Modified: 2004-01-12 12:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Damon Lynch 2003-12-23 12:06:00 UTC
Version:           be (using KDE KDE 3.1.94)
Installed from:    Compiled From Sources
Compiler:          gcc 3.3.1 KDE 3.2 beta 2 compiled using Konstruct
OS:          Linux

quanta_be does not appear to handle xml tags properly when they are a "single" tag (sorry I don't know the correct technical terminology).  For instance, the img tag.

To reproduce:

Open a file with XHTML DTD.  Edit an existing image tag using the new GUI tool to edit attributes. Before edit, the tag would be like <img .... />.  But after edit, a new tag attribute is simply placed at the end, after the necessary /. 

Quanta_be may crash at this point.  It did not crash the first time I tried it, but it does subsequently.  I'll file another bug report for that.
Comment 1 Damon Lynch 2003-12-23 22:54:18 UTC
Apologies if I was not clear: I'm referring to the new editor which allows one to edit the CSS and other attributes in a tag.  This bug exists with the latest version from CVS.
Comment 2 Chris Hornbaker 2003-12-24 16:07:14 UTC
I'm seeing this too. It's rather naster.

from:
<img src="curvtest.png" xml:lang="en" />

to:
<img src="curvtest.png" xml:lang="en" /alt="some">
Comment 3 András Manţia 2004-01-12 12:41:21 UTC
Subject: quanta_be: quanta/quanta

CVS commit by amantia: 

Fix editing of single XML tags in the new attribute editor as well as autoclosing of them.

CCMAIL: 71104-done@bugs.kde.org


  M +17 -8     document.cpp   1.216.2.21


--- quanta/quanta/document.cpp  #1.216.2.20:1.216.2.21
@@ -261,5 +261,13 @@ void Document::changeTagAttribute(Tag *t
   } else
   {
+    index = tag->attrCount() - 1;
+    if (tag->attribute(index) == "/")
+    {
+      tag->attributeNamePos(index, line, col);
+      col--;
+    } else
+    {
     tag->endPos(line, col);
+    }
     if (attrValue.isEmpty())
     {
@@ -767,6 +775,4 @@ bool Document::xmlAutoCompletion(int lin
   if (!tag) tag = userTagList.find(tagName.lower());
 
-  if ( !tag || tagName.isEmpty() )  //we are outside of any tag
-  {
     QString s = editIf->textLine(line).left(column + 1);
     int i = column;
@@ -775,4 +781,7 @@ bool Document::xmlAutoCompletion(int lin
     s = s.left(i + 1);
 
+  if ( !tag || tagName.isEmpty() )  //we are outside of any tag
+  {
+
     if ( s.endsWith(completionDTD->tagAutoCompleteAfter) )  // a tag is started
     {
@@ -814,5 +823,6 @@ bool Document::xmlAutoCompletion(int lin
   else  // we are inside of a tag
   {
-    if ( string == ">" && tagName[0] != '/' && !tagName.endsWith("/") && tag)
+    if ( string == ">" && tagName[0] != '/' && !tagName.endsWith("/") &&
+         !s.endsWith("/>") && tag)
     {
       if ( tag->parentDTD->singleTagStyle == "xml" &&
@@ -866,5 +876,4 @@ bool Document::xmlAutoCompletion(int lin
             int bl, bc;
             node->tag->beginPos(bl, bc);
-            QString s;
             if (node->tag->attrCount() > 0)
             {