Author Topic: Patch for calltip  (Read 8035 times)

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Patch for calltip
« on: April 17, 2010, 06:35:56 am »
Code
Index: src/plugins/codecompletion/codecompletion.cpp

===================================================================

--- src/plugins/codecompletion/codecompletion.cpp (revision 6203)

+++ src/plugins/codecompletion/codecompletion.cpp (working copy)

@@ -2015,14 +2015,15 @@

             ShowCallTip();
 
         // start calltip
-        if (ch == _T('('))
+        if (ch == _T('(') || ch == _T(','))
         {
             if (control->CallTipActive())
                 ++m_ActiveCalltipsNest;
             ShowCallTip();
         }
+
         // end calltip
-        else if (ch == _T(')'))
+        else if (ch == _T(')') || ch == _T(';'))
         {
             // cancel any active calltip
             control->CallTipCancel();
Test demo:
Code
MessageBox(NULL, "TEST",

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Patch for calltip
« Reply #1 on: April 17, 2010, 03:43:34 pm »
Testing it now, but had to regenerate it myself

Patch against clean trunk (works for the debugger branch too)
Code
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp       (revision 6202)
+++ src/plugins/codecompletion/codecompletion.cpp       (working copy)
@@ -2043,7 +2043,7 @@
             ShowCallTip();
 
         // start calltip
-        if (ch == _T('('))
+        if (ch == _T('(') || ch == _T(','))
         {
             if (control->CallTipActive())
                 ++m_ActiveCalltipsNest;
@@ -2051,7 +2051,7 @@
         }
 
         // end calltip
-        else if (ch == _T(')'))
+        else if (ch == _T(')') || ch == _T(';'))
         {
             // cancel any active calltip
             control->CallTipCancel();
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Patch for calltip
« Reply #2 on: April 17, 2010, 04:03:19 pm »
The patch has the same problem, then the original version, it ignores whether we are inside a string or not.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Patch for calltip
« Reply #3 on: April 17, 2010, 05:22:15 pm »
Also it doesn't fix the second time not showing bug :(

I'm not sure how to reproduce it 100%. But it is something like:
1. show the calltip for some function all (ctrl+shift+space)
2. do some editing
3. ctrl+shift+space stops working


(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Patch for calltip
« Reply #4 on: April 20, 2010, 07:04:41 am »
The patch has the same problem, then the original version, it ignores whether we are inside a string or not.
Fix it now. and i fix a new problem.
example: MessageBoxA( // here, calltip not work )
Code
Index: src/plugins/codecompletion/codecompletion.cpp

===================================================================

--- src/plugins/codecompletion/codecompletion.cpp (revision 6203)

+++ src/plugins/codecompletion/codecompletion.cpp (working copy)

@@ -1996,8 +1996,7 @@

         }
     }
 
-    if (   (event.GetEventType() == wxEVT_SCI_CHARADDED)
-        && (!control->AutoCompActive()) ) // not already active autocompletion)
+    if (event.GetEventType() == wxEVT_SCI_CHARADDED)
     {
         // a character was just added in the editor
         m_TimerCodeCompletion.Stop();
@@ -2015,25 +2014,34 @@

             ShowCallTip();
 
         // start calltip
-        if (ch == _T('('))
+        if (ch == _T('(') || ch == _T(','))
         {
-            if (control->CallTipActive())
-                ++m_ActiveCalltipsNest;
-            ShowCallTip();
+            int style = control->GetStyleAt(control->GetCurrentPos() - 2);
+            if (style != wxSCI_C_STRING && style != wxSCI_C_COMMENT)
+            {
+                if (control->CallTipActive())
+                    ++m_ActiveCalltipsNest;
+                ShowCallTip();
+            }
         }
+
         // end calltip
-        else if (ch == _T(')'))
+        else if (ch == _T(')') || ch == _T(';'))
         {
-            // cancel any active calltip
-            control->CallTipCancel();
-            if (m_ActiveCalltipsNest > 0)
+            int style = control->GetStyleAt(control->GetCurrentPos() - 2);
+            if (style != wxSCI_C_STRING && style != wxSCI_C_COMMENT)
             {
-                --m_ActiveCalltipsNest;
-                ShowCallTip();
+                // cancel any active calltip
+                control->CallTipCancel();
+                if (m_ActiveCalltipsNest > 0)
+                {
+                    --m_ActiveCalltipsNest;
+                    ShowCallTip();
+                }
             }
         }
 
-        else if (    autoCC
+        else if (   (autoCC && !control->AutoCompActive()) // not already active autocompletion
                  || (ch == _T('"')) // this and the next one are for #include's completion
                  || (ch == _T('<'))
                  || (ch == _T('.'))

[attachment deleted by admin]