Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: oBFusCATed on May 21, 2014, 03:44:55 pm

Title: Auto completion list is invisible in some situations
Post by: oBFusCATed on May 21, 2014, 03:44:55 pm
Very annoying issue if I'm typing at the bottom of the editor window and the Logs'n'others is hidden.

Steps to reproduce:
1. Maximize C::B
2. Hide Logs'n'others
3. Open a text file that can fill the full screen
4. Go to the last line
5. Show the autocompletion list

The result is that the autocompletion list is displayed below my cursor and it is almost fully invisible.
Title: Re: Auto completion list is invisible in some situations
Post by: Teybeo on July 30, 2014, 12:10:41 am
+1 very annoying
Title: Re: Auto completion list is invisible in some situations
Post by: Alpha on July 30, 2014, 03:39:38 am
This is caused by a screen vs. client coordinate issue.  The following patches this (but might break other assumptions? ... needs more testing).
Code
diff --git a/src/sdk/wxscintilla/src/PlatWX.cpp b/src/sdk/wxscintilla/src/PlatWX.cpp
index ac8d839..a9f4a8a 100644
--- a/src/sdk/wxscintilla/src/PlatWX.cpp
+++ b/src/sdk/wxscintilla/src/PlatWX.cpp
@@ -761,7 +761,7 @@ bool Window::HasFocus()
 PRectangle Window::GetPosition()
 {
     if (! wid) return PRectangle();
-    wxRect rc(GETWIN(wid)->GetPosition(), GETWIN(wid)->GetSize());
+    wxRect rc(GETWIN(wid)->GetScreenPosition(), GETWIN(wid)->GetSize());
     return PRectangleFromwxRect(rc);
 }
 
diff --git a/src/sdk/wxscintilla/src/scintilla/src/ScintillaBase.cxx b/src/sdk/wxscintilla/src/scintilla/src/ScintillaBase.cxx
index cf87a50..9890fbd 100644
--- a/src/sdk/wxscintilla/src/scintilla/src/ScintillaBase.cxx
+++ b/src/sdk/wxscintilla/src/scintilla/src/ScintillaBase.cxx
@@ -300,7 +300,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
        // Make an allowance for large strings in list
        rcList.left = pt.x - ac.lb->CaretFromEdge();
        rcList.right = rcList.left + widthLB;
-       if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) &&  // Wont fit below.
+       if (((pt.y + wMain.GetPosition().top + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) &&  // Wont fit below.
                ((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above.
                rcList.top = pt.y - heightAlloced;
        } else {

@devs: From what I can tell, Window::GetPosition() currently has an incorrect implementation, and will (always?) return top left corner as (0, 0).  Thoughts?
Title: Re: Auto completion list is invisible in some situations
Post by: oBFusCATed on July 30, 2014, 09:30:16 am
Probably you should ask in the wx-dev mailing list, there you'll get better advice, also you can contribute this patch to the wx project.
Title: Re: Auto completion list is invisible in some situations
Post by: oBFusCATed on April 01, 2018, 07:33:00 pm
Fixed in rev 11360...
The call tip has also been affected by this problem.