TextFX plugin no longer working with v.8.4.3
-
Please acquaint yourself with Scintilla’s text manipulation APIs, especially:
- SCI_GETTEXT
- SCI_GETSELTEXT
- SCI_GETCURLINE
The symbols listed above are known as “messages”. Each one maps to a public function provided by the Scintilla library. Win32 applications like Notepad++ use a system function (SendMessage()) to access Scintilla’s functions and pass data to/from them. Most plugins wrap
SendMessage()
for convenience and type safety; TextFX defines aSENDMSGTOCED
macro for this purpose.Back when TextFX was still maintained, passing one of the above messages with a final parameter of
NULL
would return the length in bytes of the target text segment, plus 1 byte for the final'\0'
character. This changed in Scintilla version 5.1.5, which no longer returns the extra byte: https://sourceforge.net/p/scintilla/bugs/2308When Notepad++ upgraded to Scintilla 5.x in release version 8.4, it inherited the new APIs: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11766
In general, fixing TextFX means adding
1
to the return value every time one of the above messages is used to discover the length of a text segment. Browsing the source tree of your fork, it seems there are still plenty of code paths in need of attention:$ git grep -niE "SCI_GET(TEXT|SELTEXT|CURLINE)," -- *.cpp SRC/NPPTextFX.cpp:4662: if (SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, 0)>1) { SRC/NPPTextFX.cpp:4759: unsigned sellen=SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, 0)-1; SRC/NPPTextFX.cpp:4802: sellen=SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, 0)-1; SRC/NPPTextFX.cpp:4848: //else if (flags&CAFLAG_GETCURLINEWHENNOSELECTION){SENDMSGTOCED(currentEdit, SCI_GETCURLINE, (sellen+1), tx); sln=sellen; } SRC/NPPTextFX.cpp:4849: else sln=SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0 , tx)-1; SRC/NPPTextFX.cpp:5093: if (SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, 0)>1 /*&& !SENDMSGTOCED(currentEdit, SCI_SELECTIONISRECTANGLE, 0, 0)*/) { SRC/NPPTextFX.cpp:5190: if (SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, 0)-1==1) { SRC/NPPTextFX.cpp:5192: SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, tx); SRC/NPPTextFX.cpp:5348: unsigned sellen; if ((sellen=SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, 0))<=1) { SRC/NPPTextFX.cpp:5354: SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, tr.lpstrText); SRC/NPPTextFX.cpp:5438: char *sSel; unsigned uSelLen; if (!SENDMSGTOCED(currentEdit, SCI_SELECTIONISRECTANGLE, 0, 0) && (uSelLen=SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0,NULL)-1)>0 && (sSel=(char *)mallocsafe(uSelLen+1,"pfDupLineDown"))) { SRC/NPPTextFX.cpp:5439: uSelLen=SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, sSel)-1; SRC/NPPTextFX.cpp:5687: if ((st=SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, NULL))>1 && (rv=(char *)mallocsafe(st,"pfvizselectassequence")) ) { SRC/NPPTextFX.cpp:5688: SENDMSGTOCED(currentEdit, SCI_GETSELTEXT, 0, rv); SRC/NPPTextFX.cpp:7475: int sln=SENDMSGTOCED(currentEdit, SCI_GETCURLINE,curpos-bol,t); SRC/Poppad/Popfind.cpp:169: if (*ppBufA) *puBufLenA=SENDMSGTOED(hwndControl, SCI_GETTEXT, uBufLenA, *ppBufA); SRC/Poppad/Popfind.cpp:1363: unsigned uSellen=SENDMSGTOED(pfr->hwndEditor, SCI_GETSELTEXT, 0, NULL)-1; // NUL byte not included SRC/Poppad/Popfind.cpp:1393: if (pfr->lpstrFindWhat) pfr->wFindWhatLen = SENDMSGTOED(pfr->hwndEditor, SCI_GETSELTEXT, 0, pfr->lpstrFindWhat) - 1;
-
Thanks for the extra details to @rainman74 . I linked the second issue which hinted at those problems to this post, which gives more details than my report a few hours ago.
-
@PeterJones @rdipardo
Thanks, I have fixed it. Version v1.0 is on its way, as now everything that is enabled should work again with NPP v8.4.x and Scintilla v5.1.5+! I have tested all Characters and Quick-Functions successfully.If there should be something else, just let me know.
-
-
I have pasted your diff and built the x64 build. I have seen that all functions seem to work with the x64 build, except for those under the “TextFX Edit …” section.
I don’t have time to deal with this at the moment.
-
-
@rainman74 - Thanks for fixing TextFX but it doesn’t seem to have UnWrap Text. Which is the one I really need. :-(
-
rainman74 isn’t really the author of TextFX, just someone who has “made it work” for newer Notepad++ versions. Thus, I’m not sure how much you have a right to expect from him, on this. Suggest you pursue some of the alternatives in the FAQ link provided earlier. For example, is there some reason that Notepad++'s own “Join Lines” doesn’t work for what you’re doing?
-
@Alan-Kilborn I have released a new version (v1.1) which now contains only the features that work and no longer crash Notepad (both x86 + x64!).
So both releases are stable for now.
The x64 functions that need a rework to run I have marked. I’ll look at those when I have time, but any help is of course welcome. Pull requests will be checked and added immediately.
-
@Daniel-Routhier said in TextFX plugin no longer working with v.8.4.3:
UnWrap Text
“UnWrap Text” is fixed and added in current build.
-
thank you for new versions of the plugun!
-
Just registered to say THANK YOU to @rainman74 for doing TextFX work again!
-
A big Thank You!
-
@rainman74 Thanks a lot for all your work on this plugin!
-
@rainman74 Thank you for the further development of textfx, I can’t work in npp without it!
-
Five “thank yous” in a row…
Try the “upvote” or “+1” button to one of @rainman74’s posts instead:
That way rainman sees it, but no one else is “bothered” by it.
-
-