-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notes for updating N++'s Scintilla beyond 5.x #10504
Comments
A time traveller! :) In my time it's still
I wanted to wait for a next release of Lexilla (which will include my latest patch) and then to try the update. However I have no idea whether it will succeed, for I'm not that good at GUI coding. |
This will also allow autocomplete to be dark (#10171) |
In one of my projects I moved from Scintilla v4.x to v5.x and found that overall no major changes are needed, but alot of code will need touched. Setting lexers is different now. You have to use Lexilla to instantiate the lexer by name (not by a SCI_xxx constant). Not sure if the names in the Notepad++ config files have the proper lexer names or not...I think they are close if not completely accurate. The interface to Scintilla has changed (not sure if the old interface is still available in Win32). From the release notes for v5.0.3:
And v5.1:
This adds a strongly typed interface which makes the code safer and more readable, but potentially a bit more verbose (not always a bad thing). My biggest concerns for Notepad++ would be plugin compatibility and external lexers. |
It is: This means that plugins should mostly still be compatible. |
@donho Any approximate time when it will be updated? |
@ArkadiuszMichalski |
@donho said:
I must have missed the change.log entry for this. :-( A long-time user (me!) would like to see a N++ release that integrates Scintilla 5.1.2 or later. :-) |
@donho Do you have an updated timeframe for the move to scintilla 5? Testbinaries could be found at https://ci.appveyor.com/project/chcg/notepad-plus-plus/builds/42099721. Seems it is mostly working.
|
Maybe Lexilla itself could be updated more often, because now we have to wait a long time for small corrections in lexers. |
Nice job! Though you have already built a branch for that. I still want to do it myself - not because of the lack of trust for your work, but for learning the new Scintilla component - by benefiting from your experience of course.
It was planned to be done earlier (and as I said in v8.2). Due to the several regressions from v8.1.6 to v8.1.9.3, I have had no time to do it. |
@donho As stated above there a still some obstacles in the way. So it seems fine for me to have a stabilisation phase for the current version. In parallel the problems with scintilla 5 could be analysed and hopefully fixed. The time frame is fine for me. |
This was a problem at Geany: SCI_GETTEXT & friends API change in Scintilla 5.1.5. |
UpdateA patch for the affected API calls was pushed to Geany's trunk: geany/geany@142b8ff Some additional contextScintilla 5.1.5 changed the return value of the SCI_GETTEXT,1 SCI_GETSELTEXT and SCI_GETCURLINE APIs to not count the terminating NUL in the total length of the string. [ Corrected by @kugel- ] Without refactoring 2 (or wrapping their return values 3), functions that call the new APIs can result in fatal allocation errors. Footnotes
|
@rdipardo Wrong! The new return values do not include the NUL terminator.
|
@kugel-, |
Avoid any pain from that for the near term, and target something earlier than 5.1.5 for Notepad++ inclusion? Actually, looking at current N++ codebase, there doesn't seem to be an overwhelming number of calls to SCI_GETTEXT, SCI_GETSELTEXT, and SCI_GETCURLINE ... so maybe it isn't a big concern. |
Don't forget the plugins 😱! |
LOL. Well, yes, my main concern (already thought about) is the PythonScript plugin. Quite frankly, I would pick another text editor if I didn't have this. But its interface to the new APIs is probably quite "wrapped" and thus necessary changes would be tightly localized. But, yes, a concern for all plugins that might use these Scintilla APIs. Perhaps not a ton of usage in the plugins either? |
From a first look at least N++ itself is not affected by this change as N++ already allocated a buffer +1 in case of the changed apis, but at e.g.
https://github.com/chcg/notepad-plus-plus/blob/scintilla5/scintilla/src/Editor.cxx#L5893 restricted to the document length (=requested one via wparam -1). So this will likely cause no direct issue of writing data beyond the buffer, but anyhow should be checked and adapted. |
|
@chcg In order to refine what you have done so far, could you please create a PR based on the branch, so the community could work on it together? |
Recent Scintilla versions have support for displaying e.g. CR/LF in a different colour. Search https://www.scintilla.org/ScintillaDoc.html for SC_REPRESENTATION_COLOUR and SCI_SETREPRESENTATIONCOLOUR It would be great if this feature makes it into N++ as well. The now closed feature request for Scintilla: https://sourceforge.net/p/scintilla/feature-requests/1129/ And some messages on the mailing list: |
@DietmarSchwertberger |
Thanks a lot. Looking forward to the release. |
Notepad++ 8.1.4 (current version as of this writing) uses Scintilla version 4.4.6. Starting from Scintilla 5.0.0 we have:
https://github.com/ScintillaOrg/lexilla
https://www.scintilla.org/Lexilla.html
https://www.scintilla.org/LexillaDoc.html
https://www.scintilla.org/ScintillaDoc.html#alpha
Issues fixed after the update:
#10925
#10651
#10908
#10706
#10065
#10423
#3858
#9229
#8359
#8087
#63
#5264
#5805, #5750
Issues that can be fixed after the update:
#11413
#10171
#10991
#11014
#10301
#1260
Even some early version (Notepad++ with new Scintilla/Lexilla) for testing would be advisable to catch possible problems.
The text was updated successfully, but these errors were encountered: