• Login
Community
  • Login

How to add new Scintilla Messages to NotepadPlusPlusPluginPack.Net

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
7 Posts 3 Posters 1.0k 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.
  • G
    Guido Thelen
    last edited by Guido Thelen Feb 7, 2023, 5:06 PM Feb 7, 2023, 5:04 PM

    Hello,
    I would like to add two new Scintilla Messages

    • SCI_REPLACETARGET
    • SCI_REPLACETARGETMINIMAL

    to the dotNet Plugin Infrastructure from Kasper B. Graversen which can be found at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net .

    Can this topic be discussed int this forum or should it be discussed at github?

    Regards
    Guido

    P 1 Reply Last reply Feb 7, 2023, 5:36 PM Reply Quote 1
    • P
      PeterJones @Guido Thelen
      last edited by Feb 7, 2023, 5:36 PM

      @Guido-Thelen

      The author of that pack hasn’t been in the forum since 2016 (at least, not under the @kbilsted username here), so discussing it here won’t change what’s available in that github download.

      When one is developing a plugin for Notepad++, one should always check the scintilla and notepad++ messages from the Notepad++ repo, and make sure that any you need to use are brought into your source code, whether you are starting from a “plugins pack” or from an older plugin or writing it completely from scratch.

      G 1 Reply Last reply Feb 7, 2023, 6:44 PM Reply Quote 3
      • G
        Guido Thelen @PeterJones
        last edited by Guido Thelen Feb 7, 2023, 6:45 PM Feb 7, 2023, 6:44 PM

        @PeterJones thanks! I am happy to add the new SCI Messages into my plugin by myself. It looks like each Scintilla message is associated to an integer

        /// Add text to the document at current position.
                SCI_ADDTEXT = 2001,
                /// Add array of cells to document.
                SCI_ADDSTYLEDTEXT = 2002,
                /// Insert string at a position.
                SCI_INSERTTEXT = 2003,
                /// Change the text that is being inserted in response to SC_MOD_INSERTCHECK
                SCI_CHANGEINSERTION = 2672,
        

        Where can I find these values for the two messages

        SCI_REPLACETARGET
        SCI_REPLACETARGETMINIMAL
        

        I want to add?

        A P 2 Replies Last reply Feb 7, 2023, 6:59 PM Reply Quote 1
        • A
          Alan Kilborn @Guido Thelen
          last edited by Feb 7, 2023, 6:59 PM

          @Guido-Thelen

          Good place to start might be:

          https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/include/Scintilla.iface

          1 Reply Last reply Reply Quote 1
          • P
            PeterJones @Guido Thelen
            last edited by PeterJones Feb 7, 2023, 7:47 PM Feb 7, 2023, 7:43 PM

            @Guido-Thelen ,

            Note that the Scintilla.iface file that @Alan-Kilborn linked to doesn’t include the SCI_ prefix, whereas Scintilla.h in the same directory of the repo does include the prefix. So you can either search the .iface for ReplaceTarget or search the .h for SCI_REPLACETARGET.

            Since I had also recommended that you verify that the Notepad++ messages haven’t changed since that plugins-pack was last published, you will also want to look at Notepad_plus_msgs.h to make sure it’s up to date.

            Please note that all these files are already linked in the Online User Manual’s “Plugin Communications” page .

            A 1 Reply Last reply Feb 7, 2023, 8:00 PM Reply Quote 2
            • A
              Alan Kilborn @PeterJones
              last edited by Feb 7, 2023, 8:00 PM

              @PeterJones

              So you can either search the .iface for ReplaceTarget or search the .h for SCI_REPLACETARGET

              I guessed that OP was going to figure that out.

              Side note: if one is going to search the Notepad++ project for Scintilla commands, and wants to see matches on the N++ AND the Scintilla side, one can’t simply do the intuitive search and look for SCI_REPLACETARGET, e.g., one really needs to start by doing a case-insensitive search for the part after SCI_; so in this case the search would be for replacetarget. The tag SCI_REPLACETARGET only appears once in the Scintilla code, in Scintilla.h.

              Alternatively, once one knows the numeric value of a command, one can search on that, and that will direct one on what they need to search on next:

              0cb17567-d1ea-4629-b805-9528aa916cf4-image.png

              From that it also appears that if this search sequence is conducted, it also gets one where they need to go:

              SCI_REPLACETARGET -> 2194 -> ReplaceTarget

              G 1 Reply Last reply Feb 7, 2023, 8:48 PM Reply Quote 4
              • G
                Guido Thelen @Alan Kilborn
                last edited by Feb 7, 2023, 8:48 PM

                @Alan-Kilborn @PeterJones, thanks! These were the info I needed. First tests are working fine. Need to do more tests.

                1 Reply Last reply Reply Quote 1
                6 out of 7
                • First post
                  6/7
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors