Plugins -> NppExport lost color format in version 7.7.7
-
NppExport.cpp makes use of
SCI_GETSTYLEBITS
which is deprecated as of scintilla 3.4.4 and returns ‘0’ with the current version. Simply replacing the value with a constant ‘8’ gets NppExport back to function. Can anyone with more insight confirm that this is a feasible way to go? -
@gerdb42 : I made the one change you recommend:
diff --git a/src/NppExport.cpp b/src/NppExport.cpp index 8dee27b..2ae0ceb 100644 --- a/src/NppExport.cpp +++ b/src/NppExport.cpp @@ -369,7 +369,8 @@ void fillScintillaData(CurrentScintillaData * csd, int start, int end) { int prevStyle = -1, currentStyle; //Mask the styles so any indicators get ignored, else overflow possible - int bits = (int)SendMessage(hScintilla, SCI_GETSTYLEBITS, 0, 0); +// int bits = (int)SendMessage(hScintilla, SCI_GETSTYLEBITS, 0, 0); + int bits = 8; unsigned char mask = 0xFF >> (8-bits); for(int i = 0; i < len; i++) { csd->dataBuffer[i*2+1] &= mask;
on the NppExport source code from GitHub (https://github.com/chcg/NPP_ExportPlugin.git) and recompiled with VS2017 and it works now in both 32-bit and 64-bit N++ 7.7.
Like you, not sure if this the correct way to go, but for the little I used NppExport, it seems to work fine. Thanks!
-
for the time being that seems to be ok, maybe you wanna create a PR on @chcg fork so that this plugin gets updated.
From my limited understanding the whole bits code can be ignored at all as a right shift 0 won’t do anything.
int bits = (int)SendMessage(hScintilla, SCI_GETSTYLEBITS, 0, 0); unsigned char mask = 0xFF >> (8-bits);
could become
unsigned char mask = 0xFF
-
-
Hi, @michael-vincent,
I noticed :
- your pull request :
https://github.com/chcg/NPP_ExportPlugin/pull/8
- your changes, below :
https://github.com/chcg/NPP_ExportPlugin/pull/8/commits/4ea80cbc315f580fa4159aa05d928cc60de005e1
So, as I’m not a coder( and wonder if I should one day ! ), could you build / compile and propose a new
Nppexport.dll
file, directly usable ? Or, may be, there’s a link, that I’ve not noticed yet, on GitHub ?Many thanks, by advance for your cooperation !
Best Regards,
guy038
-
-
Hello, @michael-vincent and All,
I shouldn’t expect your immediate reply ;-)) Again, many thanks for this fix !
So, I’ve just tested the
x86
version, only, and all options are OK ! The highlighting of selected text is kept when pasted, for instance, in Word :-))Cheers,
guy038
-
@Michael-Vincent Can you re-share that pre-release?
The ‘Pre-release here’ link doesn’t seem to work. -
@Patrick-Fulstone said:
Can you re-share that pre-release? The ‘Pre-release here’ link doesn’t seem to work.
Looks like the reason it doesn’t exist is because @chcg merged @Michael-Vincent’s pull request, and there is a new official / released tag for NppExport v0.2.9.21. You should be able to download the appropriate x86 or x64 zip, and install it over your existing NppExport, and hopefully that will work for you.
-
Yes, @PeterJones is correct, I removed my forked repo after the pull request. This is the official version
-
@Michael-Vincent Version 0.30, 32-bit, does not work for me, Npp 7.7 on Windows 10 . However, updating to Npp7.8.1 does allow Nppexport to work. So no problem here, but other users may want to update.