Community
    • Login

    TextFX plugin no longer working with v.8.4.3

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    pluginstextfxplugin
    21 Posts 11 Posters 39.1k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • rdipardoR Offline
      rdipardo @rainman74
      last edited by rdipardo

      @rainman74,

      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 a SENDMSGTOCED 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/2308

      When 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;
      
      PeterJonesP 1 Reply Last reply Reply Quote 3
      • PeterJonesP Offline
        PeterJones @rdipardo
        last edited by

        @rdipardo ,

        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.

        R 1 Reply Last reply Reply Quote 1
        • R Offline
          rainman74 @PeterJones
          last edited by rainman74

          @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.

          R Daniel RouthierD 2 Replies Last reply Reply Quote 4
          • R Offline
            rainman74 @rainman74
            last edited by

            https://github.com/rainman74/NPPTextFX2/releases/tag/1.0

            R 1 Reply Last reply Reply Quote 2
            • R Offline
              rainman74 @rainman74
              last edited by

              @rdipardo

              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.

              1 Reply Last reply Reply Quote 1
              • Terry RT Terry R referenced this topic on
              • Daniel RouthierD Offline
                Daniel Routhier @rainman74
                last edited by

                @rainman74 - Thanks for fixing TextFX but it doesn’t seem to have UnWrap Text. Which is the one I really need. :-(

                Alan KilbornA R 2 Replies Last reply Reply Quote 1
                • Alan KilbornA Offline
                  Alan Kilborn @Daniel Routhier
                  last edited by

                  @Daniel-Routhier

                  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?

                  R 1 Reply Last reply Reply Quote 0
                  • R Offline
                    rainman74 @Alan Kilborn
                    last edited by

                    @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.

                    https://github.com/rainman74/NPPTextFX2/releases/tag/1.1

                    1 Reply Last reply Reply Quote 2
                    • R Offline
                      rainman74 @Daniel Routhier
                      last edited by

                      @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.

                      Misha TolkachovM sa29979S 2 Replies Last reply Reply Quote 4
                      • mausalimiM Offline
                        mausalimi
                        last edited by

                        thank you for new versions of the plugun!

                        1 Reply Last reply Reply Quote 1
                        • Misha TolkachovM Offline
                          Misha Tolkachov @rainman74
                          last edited by

                          Just registered to say THANK YOU to @rainman74 for doing TextFX work again!

                          1 Reply Last reply Reply Quote 2
                          • Konstantin GevorgyanK Offline
                            Konstantin Gevorgyan
                            last edited by

                            A big Thank You!

                            1 Reply Last reply Reply Quote 0
                            • sa29979S Offline
                              sa29979 @rainman74
                              last edited by

                              @rainman74 Thanks a lot for all your work on this plugin!

                              1 Reply Last reply Reply Quote 0
                              • Flash600F Offline
                                Flash600
                                last edited by

                                @rainman74 Thank you for the further development of textfx, I can’t work in npp without it!

                                Alan KilbornA 1 Reply Last reply Reply Quote 0
                                • Alan KilbornA Offline
                                  Alan Kilborn @Flash600
                                  last edited by

                                  Five “thank yous” in a row…

                                  Try the “upvote” or “+1” button to one of @rainman74’s posts instead:

                                  660116b2-cd0f-44b4-bae0-cb79b5259766-image.png

                                  That way rainman sees it, but no one else is “bothered” by it.

                                  1 Reply Last reply Reply Quote 0
                                  • PeterJonesP PeterJones locked this topic on
                                  • ianwilliams1I ianwilliams1 referenced this topic on

                                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                  With your input, this post could be even better 💗

                                  Register Login
                                  • First post
                                    Last post
                                  The Community of users of the Notepad++ text editor.
                                  Powered by NodeBB | Contributors