Author Topic: Scintilla 3.7.5 update  (Read 13870 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Scintilla 3.7.5 update
« on: August 16, 2017, 09:32:28 pm »
In this branch https://github.com/obfuscated/codeblocks_sf/tree/scintilla_3_7_5 you'll be able to find C::B updated to scintilla 3.7.5.

There are many major improvements. Our current version is 3.5.x.
You can see a list of changes here http://www.scintilla.org/ScintillaHistory.html
The biggest improvements in my opinion are the improvements to the multiple cursors support.
Pasting in multiple selections is possible now. Code-completion, too, but this still doesn't work in C::B, because we're doing our own processing, so we need to do this manually. I'm still investigating how to do it.

Also there are some annoying differences between multiple cursors and rect selections. But I'm trying to fix them.

The code is tested and compiles on linux only, so if someone can provide patches for windows I'll be happy. It shouldn't be too hard to fix.

Also any testing is welcome. I hope to merge this by the end of September, but we will see...
(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 stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Scintilla 3.7.5 update
« Reply #1 on: August 17, 2017, 12:38:58 am »
What version of wxWidgets are you using under Linux; so, I can test Windows with the same version?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Scintilla 3.7.5 update
« Reply #2 on: August 17, 2017, 01:33:28 am »
wx2.8, wx3.0.x, wx3.1.master. It should work with all of them...
(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: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Scintilla 3.7.5 update
« Reply #3 on: August 19, 2017, 09:52:17 am »
I use this patch to build this branch against wx3.1 under win7.

Code
 src/CodeBlocks_wx31.cbp                 | 42 ++++++++++++++++++++++++++++++---
 src/sdk/wxscintilla/src/ScintillaWX.cpp |  4 ++--
 src/sdk/wxscintilla/src/wxscintilla.cpp |  4 +++-
 3 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/src/CodeBlocks_wx31.cbp b/src/CodeBlocks_wx31.cbp
index f4b2ceb41..23a0771d3 100644
--- a/src/CodeBlocks_wx31.cbp
+++ b/src/CodeBlocks_wx31.cbp
@@ -3334,6 +3334,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/include/SciLexer.h">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/include/Sci_Position.h">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/include/Scintilla.h">
  <Option target="scintilla" />
  </Unit>
@@ -3379,6 +3382,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>
@@ -3424,9 +3430,15 @@
  <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>
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexEDIFACT.cxx">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexEScript.cxx">
  <Option target="scintilla" />
  </Unit>
@@ -3436,6 +3448,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>
@@ -3460,9 +3475,15 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexHex.cxx">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexIndent.cxx">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexInno.cxx">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexJSON.cxx">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/lexers/LexKVIrc.cxx">
  <Option target="scintilla" />
  </Unit>
@@ -3493,6 +3514,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>
@@ -3514,13 +3538,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">
@@ -3553,6 +3577,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>
@@ -3826,6 +3853,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/src/PerLine.h">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/src/Position.h">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/src/PositionCache.cxx">
  <Option target="scintilla" />
  </Unit>
@@ -3856,6 +3886,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/src/Selection.h">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/src/SparseVector.h">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/src/SplitVector.h">
  <Option target="scintilla" />
  </Unit>
@@ -3874,6 +3907,9 @@
  <Unit filename="sdk/wxscintilla/src/scintilla/src/UnicodeFromUTF8.h">
  <Option target="scintilla" />
  </Unit>
+ <Unit filename="sdk/wxscintilla/src/scintilla/src/UniqueString.h">
+ <Option target="scintilla" />
+ </Unit>
  <Unit filename="sdk/wxscintilla/src/scintilla/src/ViewStyle.cxx">
  <Option target="scintilla" />
  </Unit>
diff --git a/src/sdk/wxscintilla/src/ScintillaWX.cpp b/src/sdk/wxscintilla/src/ScintillaWX.cpp
index 4c89076b3..10378c661 100644
--- a/src/sdk/wxscintilla/src/ScintillaWX.cpp
+++ b/src/sdk/wxscintilla/src/ScintillaWX.cpp
@@ -734,7 +734,7 @@ bool ScintillaWX::CreateSystemCaret() {
     delete [] bits;
     BOOL retval = ::CreateCaret(GetHwndOf(stc), sysCaretBitmap,
                                 sysCaretWidth, sysCaretHeight);
-    ::ShowCaret(GetHwndOf(sci));
+    ::ShowCaret(GetHwndOf(stc));
     return retval != 0;
 #else
     return false;
@@ -745,7 +745,7 @@ bool ScintillaWX::DestroySystemCaret() {
 #ifdef __WXMSW__
     if (sysCaretBitmap)
     {
-        ::HideCaret(GetHwndOf(sci));
+        ::HideCaret(GetHwndOf(stc));
         BOOL retval = ::DestroyCaret();
         if (sysCaretBitmap) {
             ::DeleteObject(sysCaretBitmap);
diff --git a/src/sdk/wxscintilla/src/wxscintilla.cpp b/src/sdk/wxscintilla/src/wxscintilla.cpp
index 07de6b3ae..fa6cd7c9e 100644
--- a/src/sdk/wxscintilla/src/wxscintilla.cpp
+++ b/src/sdk/wxscintilla/src/wxscintilla.cpp
@@ -110,7 +110,7 @@ DEFINE_EVENT_TYPE( wxEVT_SCI_MARGINCLICK );
 DEFINE_EVENT_TYPE( wxEVT_SCI_NEEDSHOWN );
 DEFINE_EVENT_TYPE( wxEVT_SCI_PAINTED );
 DEFINE_EVENT_TYPE( wxEVT_SCI_USERLISTSELECTION );
-DEFINE_EVENT_TYPE( wxEVT_SCI_URIDROPPED );
+//DEFINE_EVENT_TYPE( wxEVT_SCI_URIDROPPED );
 DEFINE_EVENT_TYPE( wxEVT_SCI_DWELLSTART );
 DEFINE_EVENT_TYPE( wxEVT_SCI_DWELLEND );
 DEFINE_EVENT_TYPE( wxEVT_SCI_START_DRAG );
@@ -5271,6 +5271,7 @@ void wxScintilla::AppendTextRaw(const char* text, int length)
 }
 
 #if WXWIN_COMPATIBILITY_3_0
+#if 0
 // Deprecated since Scintilla 3.7.2
 void wxScintilla::UsePopUp(bool allowPopUp)
 {
@@ -5284,6 +5285,7 @@ void wxScintilla::StartStyling(int start, int unused)
 
         SendMsg(SCI_STARTSTYLING, start, unused);
 }
+#endif // 0
 #endif // WXWIN_COMPATIBILITY_3_0
 
 //----------------------------------------------------------------------


The cbp file's patch is just generated from you changes against CodeBlocks-unix.cbp.
I have to comment the line
Code
+//DEFINE_EVENT_TYPE( wxEVT_SCI_URIDROPPED );
Because this is defined in the wx3.1, thus it cause conflict.

I have also comment out the two function body
Code
void wxScintilla::UsePopUp(bool allowPopUp)
void wxScintilla::StartStyling(int start, int unused)
Because they also cause build error.

Simple test the build C::B don't cause any issue.

But I see a lot of warnings like:
Code
sdk\wxscintilla\include/wx/wxscintilla.h:5613:51: warning: 'wxEVT_SCI_KEY' is deprecated: Don't handle wxEVT_SCI_KEY. It's never generated. [-Wdeprecated-declarations]
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: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Scintilla 3.7.5 update
« Reply #4 on: August 19, 2017, 10:41:02 am »
Question: at svn rev9896, some timers were added, I'm not sure those timers are still needed. I download a Scintilla 3.7.6 source code, and I see some platform like ScintillaWin, ScintillaGTK are still have those timers. (FineTickerAvailable() function get overwrite by those platforms, and return true)

But from the document here: Scintilla and SciTE

Quote
Release 4.0.0

    Released 16 August 2017.
    This is an unstable release with changes to interfaces used for lexers and platform access. Some more changes may occur to internal and external interfaces before stability is regained with 4.1.0.
    Uses C++14 features. Requires Microsoft Visual C++ 2017, GCC 7, and Clang 4.0 or newer.
    Support dropped for GTK+ versions before 2.24.
    The lexer interfaces ILexer and ILexerWithSubStyles, along with additional style metadata methods, were merged into ILexer4. Most lexers will need to be updated to match the new interfaces.
    The IDocumentWithLineEnd interface was merged into IDocument.
    The platform layer interface has changed with unused methods removed, a new mechanism for reporting events, removal of methods that take individual keyboard modifiers, and removal of old timer methods.
Those timers are deleted in 4.0.0?
« Last Edit: August 19, 2017, 11:22:08 am by ollydbg »
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 Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Scintilla 3.7.5 update
« Reply #5 on: August 20, 2017, 10:15:18 am »
Those timers are deleted in 4.0.0?
I did not look into the code, but we talk about 3.7.5 and not the coming 4.0.0, if I read it correctly. So they might still be needed.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Scintilla 3.7.5 update
« Reply #6 on: August 28, 2017, 06:05:41 pm »
I have to comment the line
Code
+//DEFINE_EVENT_TYPE( wxEVT_SCI_URIDROPPED );
Because this is defined in the wx3.1, thus it cause conflict.

This doesn't make sense. The name of the event in wxwidgets is wxEVT_STC_URIDROPPED, so there is no way for it causes a conflict!

I have also comment out the two function body
Code
void wxScintilla::UsePopUp(bool allowPopUp)
void wxScintilla::StartStyling(int start, int unused)
Because they also cause build error.

What errors?

But I see a lot of warnings like:
Code
sdk\wxscintilla\include/wx/wxscintilla.h:5613:51: warning: 'wxEVT_SCI_KEY' is deprecated: Don't handle wxEVT_SCI_KEY. It's never generated. [-Wdeprecated-declarations]
Can you paste the lines of the build log which mention the uses of these deprecated declarations?
It seems the only place left is editor_hooks.cpp that mentions wxEVT_SCI_KEY.

Question: at svn rev9896, some timers were added, I'm not sure those timers are still needed. I download a Scintilla 3.7.6 source code, and I see some platform like ScintillaWin, ScintillaGTK are still have those timers. (FineTickerAvailable() function get overwrite by those platforms, and return true)
The code in this branch is 99% the same as the code for wxstc in wxwidgets master branch.
They don't use fine timer granularity, so we're not using it also.
I want to keep our version of wxscintilla as close as the one in wxwidgets, so we could borrow code more easily.
As far as I know something changed in 3.6 that broke our implementation of the timers.
Morten knows more about this problem. So if he has time he could explain what should be done about these.

But from the document here: Scintilla and SciTE

Quote
Release 4.0.0 ....
We don't care for 4.x.x at the moment. It requires c++14 or 17 compiler and we can't use those because we need to support old linux distros.
For the next few years we'll be stuck to use only 3.x releases if there are more of them, which isn't very likely.

p.s. can someone provide patches for the other version of the codeblocks*.cbp files?
(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Scintilla 3.7.5 update
« Reply #7 on: August 28, 2017, 10:31:09 pm »
i made all changes like ollydbg:
https://github.com/bluehazzard/codeblocks_sf/tree/scintilla_3_7_5

including:
Quote
I have to comment the line
Code: [Select]

+//DEFINE_EVENT_TYPE( wxEVT_SCI_URIDROPPED );

Because this is defined in the wx3.1, thus it cause conflict.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Scintilla 3.7.5 update
« Reply #8 on: September 07, 2017, 03:44:43 am »
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 New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Scintilla 3.7.5 update
« Reply #9 on: September 07, 2017, 06:35:21 am »
Hi.  I was pointed to this thread by the discussion linked above.  I can explain some of the problems mentioned above.

For StartStyling, somewhere between the scintilla 3.6 releases and 3.7 releases, the signature to the the was changed from

Code
# Set the current styling position to pos and the styling mask to mask.
# The styling mask can be used to protect some bits in each styling byte from modification.
fun void StartStyling=2032(position pos, int mask)

To

Code
# Set the current styling position to start.
# The unused parameter is no longer used and should be set to 0.
fun void StartStyling=2032(position start, int unused)

Likewise, for the UsePopUp, the signature was changed from

Code
# Set whether a pop up menu is displayed automatically when the user presses
# the wrong mouse button.
fun void UsePopUp=2371(bool allowPopUp,)

to

Code
# Set whether a pop up menu is displayed automatically when the user presses
# the wrong mouse button on certain areas.
fun void UsePopUp=2371(int popUpMode,)

The change was made to allow popups to shown only if the mouse is clicked over the text portion of the window.  The discussion on Trac about these things and a few other items that came up during the upgrade is available here.

The reason some of the events are causing deprecation warnings is due to the fact that they were defined for wxSTC, but none of the code ever generated them.  It was decided to add those warnings to point out that handling those events won't ever do anything.  The discussion about that issue can be seen here.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Scintilla 3.7.5 update
« Reply #10 on: September 07, 2017, 09:37:08 am »
New Pagodi:
Thanks for the comment. I know why you've done all the changes.
And I'll commit a patch that removes all 3.0 compatible code from codeblocks, because we don't care for this compatibility.
I've posted my comment before doing thorough research, so some parts of it are invalid.
(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 New Pagodi

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: Scintilla 3.7.5 update
« Reply #11 on: September 14, 2017, 02:11:15 am »
I've submitted a ticket to add the FineTicker* methods to wxSTC. 

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Scintilla 3.7.5 update
« Reply #12 on: September 14, 2017, 09:23:11 am »
Yes, I saw. I'm following it. Thanks.
(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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Scintilla 3.7.5 update
« Reply #13 on: February 26, 2018, 10:05:01 pm »
Can you do some final testing:

The latest changes:
1. fix windows builds (wx3.1.1 requires a patch for uxtheme see the ticket section on sf.net for a patch)
2. apply all changes from wx-master related to scintilla: we have the fine timers, direct-write support (not enabled, but works), and more.

The changes could be found in the branch: https://github.com/obfuscated/codeblocks_sf/tree/scintilla_3_7_5
The branch has been force-pushed, so if you have changes against it you might suffer a bit. Read about git rebase --onto.

I've also spent some time to restore some of our old patches which I've not applied after the initial upgrade to 3.7.5. I'm testing without them for quite a while on linux+wx28 and I don't think they are required.
A branch with changes could be found here: https://github.com/obfuscated/codeblocks_sf/tree/scintilla_3_7_5_random_experiments
It is rebased on top of the main branch scintilla branch, so testing should be relatively easy.

Some comments about the patches that I've skipped:
1. most of the patches seems redundant.
2. the one changing the wxSCIListBox breaks things badly (see the "temp: revert reparent removal")
3. No idea why we need "38cf8e6 - wxscintilla patch: Transparency fixes"
4. Nor "81e00eb - wxscintilla patch: Drawing changes related to bitmaps"
5. "bc5b21d - temp: rect selection copy/paste" seems also unneeded and inferior to the implementation in wx-master. The one in wx-master makes it possible to rect-select copy in cb and then paste in notepad++. Our version doesn't. I don't have Visual Studio to try it, VS Code doesn't work.
6. "f88a7d5 - wxscintilla patch: Rectangular drag&drop" this works only in single editor. Some work need to be done to make it possible to drag-drop between two editor tabs or even between cb and notepad++

It will be good if more people could test these two branches, so we could commit the new version in master/trunk soon.



(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 BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Scintilla 3.7.5 update
« Reply #14 on: February 27, 2018, 12:05:58 am »
Is the final goal to use the wx integrated scintilla component? Is this even possible?

i can test this on windows