Version: (using KDE KDE 3.1.1a) OS: Linux For some files Quanta enters infinite loop when closing tag is deleted. For example it happens for file http://knowit.sourceforge.net/index.html when <sup> is entered inside <h2> (for example before "th" in "22th") and then auto-added </sup> is deleted. Four checkboxes in Quanta configuration/tag styles are set as follows: off, on, on, off.
Subject: quanta/quanta/parser CVS commit by amantia: Fix a parsing and tag autoclosing bug. It may also fix #57526. Can you please try and report success/failure? CCMAIL: 57526@bugs.kde.org CCMAIL: quanta-devel@kde.org M +12 -3 parser.cpp 1.70 M +9 -4 tag.cpp 1.24 M +1 -0 tag.h 1.23 --- quanta/quanta/parser/parser.cpp #1.69:1.70 @@ -326,4 +326,5 @@ Node *Parser::parseArea(int startLine, i tag->type = Tag::XmlTag; tag->dtd = m_dtd; + tag->validXMLTag = (openNum == 0); tag->single = QuantaCommon::isSingleTag(m_dtd->name, tag->name); if (tag->name[0] == '/') @@ -1203,5 +1204,12 @@ Node *Parser::nodeAt(int line, int col, } - if (findDeepest && node && node->tag->type == Tag::Empty) + bc = ec = el = bl = 0; + if (node) + { + node->tag->beginPos(bl, bc); + node->tag->endPos(el, ec); + } + if (node && node->tag->type == Tag::Empty && + (findDeepest || (bl == el && ec < bc)) ) { if (node->parent) @@ -1260,5 +1268,6 @@ Node *Parser::rebuild(Document *w) if ( tagStr != text || node->tag->type == Tag::Empty || - node->insideSpecial + node->insideSpecial || + node->tag->validXMLTag == false ) { @@ -1282,5 +1291,5 @@ Node *Parser::rebuild(Document *w) text = w->text(bl + lineDiff, bc, el + lineDiff, ec); tagStr = node->tag->tagStr(); - if (tagStr == text && node->tag->type != Tag::Empty && !node->insideSpecial) + if (tagStr == text && node->tag->type != Tag::Empty && !node->insideSpecial && !node->tag->validXMLTag) { if (!lastNode) --- quanta/quanta/parser/tag.cpp #1.23:1.24 @@ -36,4 +36,5 @@ Tag::Tag() m_nameLine = -1; m_nameCol = -1; + validXMLTag = true; } @@ -148,11 +149,13 @@ void Tag::parse(const QString &p_tagStr, int line = beginLine; int col = beginCol; - if ( ( beginLine == endLine && col < endCol) || - ( beginLine != endLine) ) - col++; int begin; QString textLine = m_write->editIf->textLine(line); + if ( textLine[col] == '<' && + (( beginLine == endLine && col < endCol) || + ( beginLine != endLine)) ) + col++; + while ( (textLine[col].isSpace() || textLine[col] == '>') && !textLine[col].isNull() && @@ -176,5 +179,7 @@ void Tag::parse(const QString &p_tagStr, col++; } - name = textLine.mid(begin, col-begin); + if (beginLine == endLine && col == endCol && textLine[col] != '>') + col++; + name = textLine.mid(begin, col - begin); if (!name.isEmpty()) m_nameCol = begin; --- quanta/quanta/parser/tag.h #1.22:1.23 @@ -132,4 +132,5 @@ public: DTDStruct* dtd; //the tag belongs to this DTD QString structBeginStr; //if it's a special block, contains the block beginning definition string (like <? or <style language="foo">) + bool validXMLTag; //false if the closing ">" was not found private:
Subject: Re: infinite loop when deleting closing tag W czwartek, 24 kwietnia 2003 16:17, Mantia Andras napisa
Subject: Re: infinite loop when deleting closing tag My last commit fixed this bug. Andras