TextFX plugin no longer working with v.8.4.3
-
Hello.
After updating Notepad++ to v.8.4.3, the TextFX menu disappeared from menu bar.
I use it very often, so how could i restore it and make the plugin work again? -
-
@axiom41 said in TextFX plugin no longer working with v.8.4.3:
Hello.
After updating Notepad++ to v.8.4.3, the TextFX menu disappeared from menu bar.
I use it very often, so how could i restore it and make the plugin work again?Use this new compiled version:
https://github.com/rainman74/NPPTextFX2/releases -
Unfortunately, you didn’t understand the problem with TextFX. The reason that Notepad++ started disabling TextFX wasn’t just an “arbitrary” decision, as your README claims. TextFX uses ancient calls which are no longer compatible with Notepad++ v8.4 and newer, and running certain functions in TextFX causes Noptepad++ to crash (sometimes with an “Access Violation” error, sometimes without any notification). Your re-release of TextFX as “NPPTextFX2” did not fix that incompatibility.
This is very easy to prove: I just downloaded a fresh v8.4.4-32bit, unzipped your NPPTextFX2’s NppTextFX.dll into the appropriate Plugins\NppTextFX\NppTextFX.dll, and opened Notepad++. Then I typed and some text (see example text below), did a Ctrl+A to Select All, then Ran TextFX > Edit > Unwrap Text. Notepad++ then crashes, because your TextFX2 uses the same outdated/incompatible function call that TextFX 0.25 used.
This is some text that has been spread over multiple lines This should be a new paragraph here. Good luck.
TextFX is broken, and your NPPTextFX2 did not fix the broken functions, so is broken as well. If you want to continue to develop NPPTextFX2 into a useful plugin, great, go ahead… just make sure you have tested every function that you keep in the menus to make sure they do not crash Notepad++ v8.4-and-newer before trying to publish and advertise a new version.
If you ever get it to the point where every function in your menu works without crashing Notepad++, then I will add it as an “alternative” in the FAQ, and even recommend that you submit your updated plugin to the plugins list (though I would suggest a full rename/rebrand so that it points to you and your github rather than the 2008-author and that old repo). But until that point, I will make sure that people know that your plugin will crash Notepad++ just like the original TextFX 0.25 does.
-
All,
Since @rainman74 has already replied to the issue I created, it seems there is a willingness to try to make NPPTextFX2 fully compatible with Notepad++ v8.4-and-newer; as such, I have linked to that plugin from the FAQ, with the caveat that it doesn’t yet have full compatibility. I will try to keep that FAQ up to date, so that when NPPTextFX2 has stabilized, I will remove the caveat.
-
I already refer to the 2008 author Chris Severance in the plugin itself and also to the original repo at Sourceforge in the readme. Since it was not a Github project back then, I decided to use a new repository at Github. This is not forbidden with the GNU license.
I have removed the incompatible function that causes the crash. I will have a look at it later if necessary.
From my point of view, there are no more functions that could crash Notepad v8.4.x. If there are, please post an issue and I’ll take care of it.
-
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!