Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Several improvements to Code Completion plugin

<< < (4/29) > >>

Huki:

--- Quote from: oBFusCATed on September 08, 2013, 11:07:56 pm ---
--- Quote from: Huki on September 08, 2013, 10:14:57 pm ---Additional info: the old test simply takes a rect from selection start to selection end, so it gives incorrect results when selecting multiple lines. I've attached some screenshots below - the red rectangle shows the incorrectly detected selection block. It's something that bothered me when I was selecting text (to copy, etc) and noticed the tooltip appearing behavior was not consistent.

--- End quote ---
Understood and I was able to reproduce it. Also I was able to implement it in a simpler way:

Can you try if this snippet fulfils all your requirements?
--- End quote ---
Yes, your code does the job nicely.


--- Quote ---One note:
Scintilla fixes should go to the Scintilla project first.
--- End quote ---
Ok, I agree.


--- Quote ---Also I think your wxDynamicLib modification to (wx)Scintilla are too much and we cannot accept them (this is my opinion and others should speak, too, especially Morten as he is the maintainer of this component in C::B).
You'll have to find another way to do it. Probably consulting with Scintilla devs for a way to do it or to ask them to add some API that will suit you.
--- End quote ---
Avoiding wxDynamicLib in Scintilla should be easy, I'll update that part soon.

oBFusCATed:

--- Quote from: Huki on September 09, 2013, 11:09:54 pm ---Yes, your code does the job nicely.

--- End quote ---
In svn...

Alpha:

--- Quote from: oBFusCATed on September 10, 2013, 10:31:12 am ---
--- Quote from: Huki on September 09, 2013, 11:09:54 pm ---Yes, your code does the job nicely.

--- End quote ---
In svn...

--- End quote ---
The following is more succinct (but perhaps less readable?), and has the same execution.

--- Code: ---Index: src/sdk/cbplugin.cpp
===================================================================
--- src/sdk/cbplugin.cpp (revision 9299)
+++ src/sdk/cbplugin.cpp (working copy)
@@ -207,12 +207,10 @@
             int startPos = stc->GetSelectionStart();
             int endPos = stc->GetSelectionEnd();
             int mousePos = stc->PositionFromPointClose(mousePosition->x, mousePosition->y);
-            if (mousePos == wxSCI_INVALID_POSITION)
+            if (startPos > mousePos || endPos < mousePos)
                 return wxEmptyString;
-            else if (startPos <= mousePos && mousePos <= endPos)
+            else
                 return selected_text;
-            else
-                return wxEmptyString;
         }
         else
             return selected_text;

--- End code ---

oBFusCATed:
Don't like... I prefer the check for wxSCI_INVALID_POSITION

Huki:
I have updated the scintilla grey out patch, let me know what you think of this one.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version