Bug 80605 - css autocompletion style tag
Summary: css autocompletion style tag
Status: RESOLVED FIXED
Alias: None
Product: quanta
Classification: Unmaintained
Component: general (show other bugs)
Version: 3.2.2
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: András Manţia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-29 11:51 UTC by arne anka
Modified: 2006-09-09 12:21 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description arne anka 2004-04-29 11:51:20 UTC
Version:           3.2.2 (using KDE 3.2.2,  (testing/unstable))
Compiler:          gcc version 3.3.3 (Debian 20040401)
OS:          Linux (i686) release 2.6.5

auto-completion of tags for css works inside 
<style>
 .foo {}
</style>
but not inside
<foo style="">
would be nice to hve it there too ...
Comment 1 András Manţia 2006-09-09 12:21:57 UTC
SVN commit 582414 by amantia:

Make CSS completion work inside style attributes.

BUG: 80605

 M  +3 -0      ChangeLog  
 M  +2 -2      quanta.kdevelop  
 M  +47 -10    src/document.cpp  


--- branches/KDE/3.5/kdewebdev/quanta/ChangeLog #582413:582414
@@ -20,7 +20,10 @@
       - fix automatic updating of closing tags [#132357]
       - accept float numbers for length values [#130295]
 
+ - improvements:
+      - make CSS completion work inside style attributes [#80605]
 
+
 Version 3.5.4 (Release date: 02-08-2006; Started 24-06-2005):
  - bugfixes:
       - make Open File in context menu work for remote projects as well
--- branches/KDE/3.5/kdewebdev/quanta/quanta.kdevelop #582413:582414
@@ -245,10 +245,10 @@
   </kdevcvs>
   <kdevfilecreate>
     <filetypes>
-      <type icon="" ext="h" create="template" name="C++ header" >
+      <type icon="" ext="h" name="C++ header" create="template" >
         <descr>Quanta speicfic header</descr>
       </type>
-      <type icon="source_cpp" ext="cpp" create="template" name="C++ source" >
+      <type icon="source_cpp" ext="cpp" name="C++ source" create="template" >
         <descr>A new empty C++ file.</descr>
       </type>
     </filetypes>
--- branches/KDE/3.5/kdewebdev/quanta/src/document.cpp #582413:582414
@@ -1050,17 +1050,46 @@
          }
     else if ( string[0] == qConfig.attrValueQuotation )
           {
-          //we need to find the attribute name
-          QString textLine = editIf->textLine(line).left(column-1);
-          QString attribute = textLine.mid(textLine.findRev(' ')+1);
-          showCodeCompletions( getAttributeValueCompletions(tagName, attribute) );
-          handled = true;
+            //we need to find the attribute name
+            QString textLine = editIf->textLine(line).left(column-1);
+            QString attribute = textLine.mid(textLine.findRev(' ')+1);
+            if (attribute == "style" && completionDTD->insideDTDs.contains("css"))
+            {
+              completionDTD = DTDs::ref()->find("text/css");
+              completionRequested = true;
+              return scriptAutoCompletion(line, column + 1, string);
+            }
+            showCodeCompletions( getAttributeValueCompletions(tagName, attribute) );
+            handled = true;
           }
   } // else - we are inside of a tag
   if (!handled)
   {
+    //check if we are inside a style attribute, and use css autocompletion if we are
+    QString textLine = editIf->textLine(line);
+    textLine = textLine.left(column);
+    int pos = textLine.findRev('"');
+    if (pos != -1)
+    {
+      pos = textLine.findRev(' ', pos);
+      if (pos != -1)
+      {
+        textLine = textLine.mid(pos + 1);
+        pos = textLine.find('=');
+        if (pos != -1)
+        {
+          QString attribute = textLine.left(pos);
+          if (attribute == "style" && completionDTD->insideDTDs.contains("css"))
+          {
+            completionDTD = DTDs::ref()->find("text/css");
+            completionRequested = true;
+            return scriptAutoCompletion(line, column + 1, string);
+          }
+        }
+      }
+    }
     QString s = editIf->textLine(line).left(column + 1);
-    int pos = s.findRev('&');
+    pos = s.findRev('&');
     if (pos != -1)
     {
       //complete character codes
@@ -2064,10 +2093,18 @@
       index = tag->valueIndexAtPos(line,col);
       if (index != -1)      //inside a value
       {
-        tag->attributeValuePos(index, bLine, bCol);
-        s = tag->attributeValue(index).left(col - bCol);
-        showCodeCompletions( getAttributeValueCompletions(tagName, tag->attribute(index), s) );
-        handled = true;
+        s = tag->attribute(index);
+        if (s == "style" && completionDTD->insideDTDs.contains("css"))
+        {
+          completionDTD = DTDs::ref()->find("text/css");
+          return scriptAutoCompletion(line, col, "");
+        } else
+        {
+          tag->attributeValuePos(index, bLine, bCol);
+          s = tag->attributeValue(index).left(col - bCol);
+          showCodeCompletions( getAttributeValueCompletions(tagName, tag->attribute(index), s) );
+          handled = true;
+        }
       } else
       {
         index = tag->attributeIndexAtPos(line,col);