Community
    • Login

    Announcing Perl-based automation of Notepad++

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    perlautomation
    16 Posts 2 Posters 3.1k Views
    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.
    • Michael VincentM
      Michael Vincent @PeterJones
      last edited by

      @PeterJones said in Announcing Perl-based automation of Notepad++:

      So, if it were up to you(*)

      Let me give it think. My first instinct is to keep them separate instead of a single big hash-of-hash. To me that just makes more sense grouping N++, messages and Scintilla with their like instead of mixing.

      More on App::PerlShell - if you read the POD, there are other REPL’s for Perl that excel at certain aspects of REPL - one duplicates Python look and feel, another uses PPI for correct Perl parsing at the expense of many dependencies, etc. I wanted one that behaved more like a shell (e.g., bash, Powershell) but took Perl commands and none did that. That said, my implementation is probably pretty poor, rough around the edges and makes a multitude of assumptions. All this to say, happy for you to use it, that’s what it’s there for … but “production ready” it may not be like say Devel::REPL.

      Cheers.

      1 Reply Last reply Reply Quote 1
      • PeterJonesP
        PeterJones
        last edited by

        v0.002 released to CPAN

        • Reorganize the hash variables for easier and clearer use going forward (#13)
        • editor->getLine() on an empty line will now correctly return an empty string, not “\0” (fixed #14)
        • update API for getNumberOpenFiles to correctly use the constants (#17)
        • add notepad->getNppVar() for accessing the “user variables”, like FULL_CURRENT_PATH and CURRENT_WORD (#19)
        • improve documentation internal links (#20)
        • make the editor->hwnd() a public method (instead of using editor()->{_hwnd})
        • make the notepad->hwnd() a public method (instead of using notepad()->{_hwnd})
        • add helper editor->getEOLString(): convert EOL Mode integer to a string
        • editor->getFileEndPosition(): gives the end position of the whole document
        • improve test coverage: add encoding names and getLanguageName coverage to npp-buffer.t
        • examples/ folder: adding more example usages
        • improve Editor documentation on ->findText and some other methods, and clean up set/get pairs, so they share the same information
        • improve Notepad documentation, especially fixing the link for menuCmdID source file
        PeterJonesP 1 Reply Last reply Reply Quote 3
        • PeterJonesP
          PeterJones @PeterJones
          last edited by

          v0.003 released to CPAN

          The user-centric changes that were made:

          • some of the Scintilla v4.2.0 messages that were implemented in Notepad++ v7.8 were missing, so add them (#29: thanks @Michael-Vincent for pointing this out!)
          • runPluginsCommand() = fixed command cache feature and improved test (#30)
          • added version notes, to say which messages and “enums” (hashes/keys) require NPP v7.8 (because these are the Scintilla v4.2.0 updates)

          I keep trying to improve this, and make it more usable. Suggestions and bug reports welcome.

          Michael VincentM 1 Reply Last reply Reply Quote 3
          • Michael VincentM
            Michael Vincent @PeterJones
            last edited by

            @PeterJones

            Saw your N++ commit updating Perl keywords and the autocomplete API. BRAVO!!! I had an updated perl.xml autocomplete, but yours is way more complete and I’ve started using it this morning to test.

            Thanks for keeping Perl updated in N++!!

            Cheers.

            PeterJonesP 2 Replies Last reply Reply Quote 1
            • PeterJonesP
              PeterJones @Michael Vincent
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Michael Vincent
                last edited by

                @Michael-Vincent,

                I was trying to figure out if I had a place to reply with that link, or whether I’d have to create a new post. I guess here was as good a place as any. Since Don accepted the PR, it should be in the next official release! (This is my first contribution to the main Notepad++, rather than just documentation or UDL, so I’m happy about that!)

                I basically wrote a regex to trim out just the functions (=item) and the brief summary line (=for Pod::Functions) from perlfunc.pod, then used another few regex to merge those together into the auto-complete format; that way, I am hopeful I didn’t miss any functions from v5.30.

                Michael VincentM 1 Reply Last reply Reply Quote 0
                • Michael VincentM
                  Michael Vincent @PeterJones
                  last edited by

                  @PeterJones said in Announcing Perl-based automation of Notepad++:

                  I basically wrote a regex

                  I did mine by hand. Happy to throw that away for your more complete and automated creation solution. I’ll be grabbing 7.8.7 when officially released.

                  Cheers.

                  PeterJonesP 1 Reply Last reply Reply Quote 0
                  • PeterJonesP
                    PeterJones @Michael Vincent
                    last edited by

                    v0.005 released to CPAN

                    The user-centric changes that were made:

                    • replace %ENCODINGKEY with %BUFFERENCODING, because the old hash had wrong values that didn’t match getEncoding()'s return values (#50)
                    • add setEncoding() command to call NPPM_SETBUFFERENCODING as the logical pair to getEncoding() (#51)

                    I had apparently missed announcing v0.004 and bugfix 0.004001, so for historical purposes, quoting from my CHANGES file

                    v0.004001 2020-Jun-20

                    • fix bug in notepad->prompt(), which only used two of the three
                      arguments, in wrong order (#47); test suite verifies default
                      values for title and default when they aren’t used
                    • added new examples/pasteSpecial.pl to show how to paste a
                      clipboard entry other than CF_TEXT into Notepad++

                    v0.004 2020-Jun-04

                    • fix bug in propertyNames() which deleted final char (#45)
                    • implemented helper methods: forEachLine, deleteLine, replaceWholeLine,
                      replaceLine, flash, getWord, getCurrentWord, getUserLineSelection,
                      getUserCharSelection (#15)
                    • make setTarget an alias of setTargetRange, and write an alias of
                      addText, for PythonScript compatibility (#15)
                    • implemented new auto-wrapper to get searchInTarget and similar calls
                      to work right (#42)
                    • fixed replaceTarget() and replaceTargetRE() replacing target with the
                      empty string (#41)
                    • fixed length bug in getTargetText() (#40)
                    • fixed bug in editor->setText(‘’) which had empty strings
                      cause crash (#39)
                    PeterJonesP 1 Reply Last reply Reply Quote 0
                    • PeterJonesP
                      PeterJones @PeterJones
                      last edited by

                      v0.007 released to CPAN

                      • Update Editor object for the Notepad++ 7.9.4 update to Scintilla v4.4.6

                      And, again, I had forgotten to announce last month:

                      v0.006 2021-Mar-06

                      • add getSettingsOnCloudPath() with test (#54)
                      • add getLineNumberWidthMode(), setLineNumberWidthMode(), and the %LINENUMWIDTH enumeration with test (#54 addendeum)
                      • test suite bug: with v7.9.1 and newer, replaceTargetText() changes the selection/getTargetText() value, so update the readback to be version agnostic (#57)
                      • documentation error: fox %NPPIDM description in Notepad.pm (#53)
                      • meta fix: make test suite pass on cpantesters smoke testers, even if smoke tester machine doesn’t have Notepad++, or has an old, incompatible version (#56)

                      v0.006001 2021-Mar-07

                      • meta fix: turn off the auto-download on smoke tester machines, because it was causing fails
                      PeterJonesP 1 Reply Last reply Reply Quote 2
                      • PeterJonesP
                        PeterJones @PeterJones
                        last edited by

                        v0.008 released to CPAN

                        • add notepad->showDocList, notepad->isDocListShown, and notepad->docListDisableColumn for working with the Document List panel (previously “Doc Switcher” panel)
                        • incorporate the new messages and menu commands thru v8.1.4 (#80)
                        • add notepad->getStatusBar(), which will get the text of one of the sections of the status bar (#65)
                        • add notepad->getDebugInfo(), which (for new-enough Notepad++) includes the ‘Command line’ entry from Debug Info (#74)
                        • add %WINMSGBOX for use with notepad->messageBox (#73)
                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors