[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdewebdev/quanta/src
From:       Andras Mantia <amantia () kde ! org>
Date:       2005-02-08 18:31:52
Message-ID: 20050208183152.C67311CFD4 () office ! kde ! org
[Download RAW message or body]

CVS commit by amantia: 

Fixes in script autocompletion:
- show the new tag autocompletion only after pressing space after the tag separator
- don't show the hint and the autocompletion box at the same time. Show the hint only \
if it was requested.


  M +20 -11    document.cpp   1.359
  M +2 -1      document.h   1.126


--- kdewebdev/quanta/src/document.cpp  #1.358:1.359
@@ -713,5 +713,5 @@ void Document::slotCompletionDone( KText
 void Document::slotDelayedScriptAutoCompletion()
 {
-  scriptAutoCompletion(m_lastLine, m_lastCol);
+  scriptAutoCompletion(m_lastLine, m_lastCol, "");
 }
 
@@ -818,5 +818,5 @@ void Document::slotCharactersInserted(in
     if (completionDTD->family == Script)
     {
-      handled = scriptAutoCompletion(line, column);
+      handled = scriptAutoCompletion(line, column, string);
       if (!handled && string == ">")
       {
@@ -1580,5 +1580,5 @@ QString Document::findDTDName(Tag **tag)
 
 /** Called whenever a user inputs text in a script type document. */
-bool Document::scriptAutoCompletion(int line, int column)
+bool Document::scriptAutoCompletion(int line, int column, const QString& \
insertedString)  {
  bool handled = false;
@@ -1662,7 +1662,10 @@ bool Document::scriptAutoCompletion(int 
      } else
      {
+       if (hintRequested)
+       {
        arguments = tag->name() + ": " + tag->attributeAt(0)->name + ";";
        argList.append(arguments);
        codeCompletionIf->showArgHint(argList, ":;" , \
completionDTD->attributeSeparator); +       } else
        showCodeCompletions( getAttributeValueCompletions(tag->name(), \
tag->attributeAt(0)->name, startStr));  }
@@ -1687,5 +1690,9 @@ bool Document::scriptAutoCompletion(int 
    }
  }
- if ( !handled && (completionRequested || s[i] == \
completionDTD->tagAutoCompleteAfter || completionDTD->tagAutoCompleteAfter == '\1' || \
completionDTD->memberAutoCompleteAfter.searchRev(s) != -1) && !argHintVisible) + if ( \
!handled && !argHintVisible &&  +      (completionRequested || 
+       (s[i] == completionDTD->tagAutoCompleteAfter && (insertedString == " " || \
insertedString[0] == completionDTD->tagAutoCompleteAfter)) ||  +       \
completionDTD->tagAutoCompleteAfter == '\1' || \
(!completionDTD->memberAutoCompleteAfter.pattern().isEmpty() && \
completionDTD->memberAutoCompleteAfter.searchRev(s) != -1)) +       )
  {
    showCodeCompletions(getTagCompletions(line, column + 1));
@@ -1844,4 +1851,5 @@ void Document::codeCompletionRequested()
   completionInProgress = false;
   argHintVisible = false;
+  hintRequested = false; 
   handleCodeCompletion();
   completionRequested = false;
@@ -1863,5 +1871,5 @@ void Document::handleCodeCompletion()
     if (completionDTD->tagAutoCompleteAfter == '\0')
         completionDTD->tagAutoCompleteAfter = '\1';
-    handled = scriptAutoCompletion(line, col - 1);
+    handled = scriptAutoCompletion(line, col - 1, "");
     if (completionDTD->tagAutoCompleteAfter == '\1')
         completionDTD->tagAutoCompleteAfter = '\0';
@@ -1905,5 +1913,6 @@ void Document::codeCompletionHintRequest
 //    int pos2 = textLine.findRev(")");
     //if (pos > pos2 )
-       scriptAutoCompletion(line, col - 1);
+    hintRequested = true; 
+    scriptAutoCompletion(line, col - 1, "");
   }
   completionRequested = false;

--- kdewebdev/quanta/src/document.h  #1.125:1.126
@@ -270,4 +270,5 @@ private:
   bool completionRequested; ///< true if the code completion was explicitely \
requested by the user  bool argHintVisible;
+  bool hintRequested;
   bool reparseEnabled;
   bool repaintEnabled;
@@ -304,5 +305,5 @@ private:
   bool xmlAutoCompletion(int , int , const QString & );
   /** Called whenever a user inputs text in a script type document. */
-  bool scriptAutoCompletion(int line, int col);
+  bool scriptAutoCompletion(int line, int col, const QString &insertedString);
   /** Returns true if the number of " (excluding \") inside text is even. */
   bool evenQuotes(const QString &text);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic