Author Topic: Strange cursor position with wx3.0.2 (scintilla)  (Read 8358 times)

Offline headkase

  • Almost regular
  • **
  • Posts: 159
Strange cursor position with wx3.0.2 (scintilla)
« on: December 20, 2015, 02:58:07 am »
Edit: Posts in this thread were split from: This thread.

The cursor issues are not new however, I have tried to build with 3.0.2 previously, as in months previously, ever so often and the issue has been present each time.  I always assumed that it was attributable to 3.0.2 not being "baked" enough.  However, I guess I should have reported it a long whiles back.  If the issue is in the Code::Blocks source then it has been present for a good while.

If you have any patches I can test apply to any specified SVN build then feel free to post them.  I will gladly recompile away if it helps to stomp out a bug or few.

Edit: I just rebuilt wxWidgets 3.0.2 64-bit without CFG=64 so I did not have to modify that variable in the SVN 10625 project.  Same error as given above.  I am, as stated in the first post, using MinGW-Builds 5.2.0 64 bit and I also have the 32 bit version as well.

Let's try a different tack.  You tell me exactly which compiler to use and either 32 or 64 bit or both and I will build the wxWidgets 3.0.2 versions with that toolchain.  That way we can also rule out MinGW-Builds as the compiler.
« Last Edit: December 21, 2015, 03:45:52 pm by headkase »

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #1 on: December 20, 2015, 06:00:09 am »
What happens on my system, I can compile wxWidgets 3.0.2 64 bit with no errors.  Then I can build codeblocks wx 30 64 also with no errors.  Run it, it loads fine.  However, open a text window the cursor caret does not behave properly.  If you go up or down a line it may leave an old cursor bar graphic there, or up or down, left or right, all the arrow keys: it either leaves a artifact or does not update.  Either graphical garbage or an invisible caret.  No errors are thrown at all that I am aware of.  It just doesn't work like it's supposed to.

I am not a technical expert so I do not know where to begin troubleshooting that.  If you provide a concrete list of steps to try and report the results of then I would gladly do them.
I have 32 bit cb build myself with against wx3.0.2 under Windows XP.
I see some similar issue, see screen shot:

sometimes, I see two cursors in the previous locations, see screen shot:

Here is the steps to reproduce:
When I first put the cursor after the "main()", and I hit the arrow down key. I see the cursor is still there. After that, I hit the arrow down key again, I see the cursor is still there after the "{", and now the cursor is located after the "vector".
I guess it is related to highlight of the "()" or "{}".
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #2 on: December 20, 2015, 02:30:52 pm »
It works fine on linux when using wx3.0, so it might be windows only issue.

@Morten: Are you able to reproduce the problem?
(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 ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #3 on: December 20, 2015, 03:22:30 pm »
It works fine on linux when using wx3.0, so it might be windows only issue.
It looks like it's an issue related to the "indicator" of the scintilla. I have download the latest wscite, but I don't know how to enable the brace indicator in it.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #4 on: December 20, 2015, 03:59:31 pm »
Matching brace highlighting works fine on linux. No visual artefacts observed.
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #5 on: December 20, 2015, 05:38:05 pm »
@Morten: Are you able to reproduce the problem?
Works fine here, on windows with wx2.8.12 and trunk.

What are the editor options related to highlighting for you?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #6 on: December 20, 2015, 05:45:27 pm »
Morten: Please try wx3.0 or wx-master branch, if possible. The reported problem is with wx3.0.2.
(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 jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #7 on: December 20, 2015, 07:37:55 pm »
Morten: Please try wx3.0 or wx-master branch, if possible. The reported problem is with wx3.0.2.
The thread-title is soewhat misleading in this case.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #8 on: December 20, 2015, 07:42:21 pm »
Jens: Yep...  ::)
(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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9508
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #9 on: December 20, 2015, 08:25:02 pm »
Morten: Please try wx3.0 or wx-master branch, if possible. The reported problem is with wx3.0.2.
Yes, on wx3.0.2 it shows the effect. However, we should not seriously try to fix it in trunk. Instead, we should focus and fix the scintilla branch. I am still trying to get it working but so far I didn't have enough time to finish. We lack behind many versions already and there have been massive fundamental changes in the architecture of scintilla. So give it a try, if you like:
https://svn.code.sf.net/p/codeblocks/code/branches/scintilla_3_6_x
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #10 on: December 20, 2015, 09:31:58 pm »
No time at the moment. I'm concentrated on fixing all the asserts that come up with wx30.
(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 headkase

  • Almost regular
  • **
  • Posts: 159
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #11 on: December 20, 2015, 10:27:06 pm »
Morten: Please try wx3.0 or wx-master branch, if possible. The reported problem is with wx3.0.2.
The thread-title is soewhat misleading in this case.

Please feel free to split the thread - a simple observation on my part spawned an entire new branch.  ;)

Offline mageia

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #12 on: December 21, 2015, 05:01:42 am »
yes,wx3.02 the cursor is weird,select text hilight area is not what i select,also is because get the wrong cursor position?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #13 on: December 21, 2015, 04:06:25 pm »
Morten: Please try wx3.0 or wx-master branch, if possible. The reported problem is with wx3.0.2.
Yes, on wx3.0.2 it shows the effect. However, we should not seriously try to fix it in trunk. Instead, we should focus and fix the scintilla branch. I am still trying to get it working but so far I didn't have enough time to finish. We lack behind many versions already and there have been massive fundamental changes in the architecture of scintilla. So give it a try, if you like:
https://svn.code.sf.net/p/codeblocks/code/branches/scintilla_3_6_x
A patch to fix the build error:
Code: [Select]
src/CodeBlocks_wx30.cbp | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/CodeBlocks_wx30.cbp b/src/CodeBlocks_wx30.cbp
index 263249e..d98b603 100644
--- a/src/CodeBlocks_wx30.cbp
+++ b/src/CodeBlocks_wx30.cbp
@@ -3416,6 +3416,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexBasic.cxx">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexBatch.cxx">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexBibTeX.cxx">
  <Option target="scintilla" />
  </Unit>
@@ -3461,6 +3464,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexDMIS.cxx">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexDiff.cxx">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexECL.cxx">
  <Option target="scintilla" />
  </Unit>
@@ -3473,6 +3479,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexErlang.cxx">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexErrorList.cxx">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexFlagship.cxx">
  <Option target="scintilla" />
  </Unit>
@@ -3530,6 +3539,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexMagik.cxx">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexMake.cxx">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexMarkdown.cxx">
  <Option target="scintilla" />
  </Unit>
@@ -3551,13 +3563,13 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexNsis.cxx">
  <Option target="scintilla" />
  </Unit>
- <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexOScript.cxx">
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexNull.cxx">
  <Option target="scintilla" />
  </Unit>
- <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexOpal.cxx">
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexOScript.cxx">
  <Option target="scintilla" />
  </Unit>
- <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexOthers.cxx">
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexOpal.cxx">
  <Option target="scintilla" />
  </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexPB.cxx">
@@ -3590,6 +3602,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexProgress.cxx">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexProps.cxx">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexPython.cxx">
  <Option target="scintilla" />
  </Unit>
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5247
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Strange cursor position with wx3.0.2 (scintilla)
« Reply #14 on: December 23, 2015, 04:04:36 pm »
When debug the scintilla branch with wx 3.02 under windows, I noticed that when an editor opened by the statement:

Code: [Select]
m_pControl->InsertText(0, enc.GetWxStr());

Code: [Select]
case SCI_INSERTTEXT: {
if (lParam == 0)
return 0;
int insertPos = static_cast<int>(wParam);
if (static_cast<int>(wParam) == -1)
insertPos = CurrentPosition();
int newCurrent = CurrentPosition();
char *sz = CharPtrFromSPtr(lParam);
const int lengthInserted = pdoc->InsertString(insertPos, sz, istrlen(sz));
if (newCurrent > insertPos)
newCurrent += lengthInserted;
SetEmptySelection(newCurrent);
return 0;
}
And I see that the null terminated string is needed, but when debugging, I see we pass a string with out the null at the end.
This gives the screen shot:
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.