Community
    • Login

    [New Plugin] MultiReplace

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    67 Posts 11 Posters 13.7k 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.
    • Thomas KnoefelT
      Thomas Knoefel @Vitalii Dovgan
      last edited by

      @Vitalii-Dovgan said in [New Plugin] MultiReplace:

      For some reason I had an impression that the Find-Replace list, as well as the histories of the “Find what” and “Replace with” are automatically saved when Notepad++ exits… Could this be added?

      I had this already in mind when I started implementation but forgot about it. Yes, I will implement this.

      1 Reply Last reply Reply Quote 1
      • Thomas KnoefelT
        Thomas Knoefel @Vitalii Dovgan
        last edited by Thomas Knoefel

        @Vitalii-Dovgan said in [New Plugin] MultiReplace:

        As maybe an idea for the future version of the MultiReplace plugin, the replacements performance could be dramatically increased

        I conducted performance tests yesterday and observed a noticeable difference in performance. There is still room for improvement, but I can confirm that there were no crashes. Specifically, the performance of CopyToClipboard is lacking. However, I will prioritize addressing this in the next release.

        I’m considering another feature that could be quite helpful and compensate for the absence of Find capabilities. Next to the Mark button, it might be possible to add up and down keys (similar to those found in NPP Find). After marking, it would be useful to navigate to the marked positions, especially in large files. From a technical standpoint, I’m working on a concept, but I’m not yet convinced about the final result. It would be easy to store all marked positions and sort them. However, if any changes are made to the file, it cannot be guaranteed that these positions are still correct or that the marked text still exists. This presents a limitation. After marking all strings, the plugin should detect any changes. In such cases, the up and down navigation should be disabled. Only by marking all strings again would these buttons be enabled. I haven’t researched Scintilla yet, particularly how to detect changes after a specific moment, and perhaps this would need to be monitored through WM_TIMER. However, I’m still unsure if this limitation is acceptable. There might be other ways to solve it that I haven’t explored yet

        Mark OlsonM 1 Reply Last reply Reply Quote 0
        • Thomas KnoefelT
          Thomas Knoefel @Vitalii Dovgan
          last edited by

          @Vitalii-Dovgan said in [New Plugin] MultiReplace:

          For some reason I had an impression that the Find-Replace list, as well as the histories of the “Find what” and “Replace with” are automatically saved when Notepad++ exits…

          The INI support has been integrated. All settings of List, History, and Options are stored in the INI and will be reopened when loading the Plugin.

          Due to the addition of some extra features that I am still working on, I will release RC4 a bit later.

          1 Reply Last reply Reply Quote 2
          • Thomas KnoefelT
            Thomas Knoefel
            last edited by

            RC-4 has been finished, featuring:

            • New Find and Replace functionality in 2Buttons Mode.
            • Sort lists by clicking on the header.

            Several optimizations and fixes, including:

            • Update of INI Unicode support.
            • Updates of Codepage assignments.
            • Clipboard copy performance optimization.
            • and a lot of other adjustments

            Feel free to test it! You can find it on Github.

            1 Reply Last reply Reply Quote 2
            • Mark OlsonM
              Mark Olson @Thomas Knoefel
              last edited by

              @Thomas-Knoefel said in [New Plugin] MultiReplace:

              After marking all strings, the plugin should detect any changes.

              Pretty sure the way to check if a file has been modified is to subscribed to the SCN_MODIFIED notification and check if the text field of the notification object has been populated (since the notification can fire if there are changes other than text changes).

              But of course your plugin changes the text itself, and so you need some way to distinguish from your plugin’s changes… Hmm…

              Thomas KnoefelT 1 Reply Last reply Reply Quote 2
              • Mark OlsonM
                Mark Olson
                last edited by Mark Olson

                Actually, there’s an even easier way that I just remembered to determine if a SCN_MODIFIED notification entails text changing:
                check if (notification.modificationType & 3) != 0

                This works because 3 = SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT, and all text modifications trigger a notification with one of those flags set.

                1 Reply Last reply Reply Quote 2
                • Thomas KnoefelT
                  Thomas Knoefel @Mark Olson
                  last edited by

                  @Mark-Olson said in [New Plugin] MultiReplace:

                  But of course your plugin changes the text itself, and so you need some way to distinguish from your plugin’s changes… Hmm…

                  Indeed, this can quickly turn into a complex issue. That’s why I’ve added a regular Find feature, which wasn’t originally planned but serves the same purpose I intended to implement. The advantage here is that it’s easier to maintain and isn’t solely limited to locating positions within Marked Strings. Sometimes, exploring alternative approaches proves to be simpler… thanks for your support; this will answer the questions I was looking for!

                  1 Reply Last reply Reply Quote 2
                  • Vitalii DovganV
                    Vitalii Dovgan
                    last edited by

                    A tiny thing that confuses me with each update of the plugin: it’s physical name is “NppMultiReplace.dll” and, correspondingly, its folder name is “NppMultiReplace”, and in the same time the plugin identifies itself as “MultiReplace” (without “Npp”) in the main menu.
                    Maybe the same name in both places would be better?

                    Michael VincentM Thomas KnoefelT 2 Replies Last reply Reply Quote 1
                    • Michael VincentM
                      Michael Vincent @Vitalii Dovgan
                      last edited by

                      @Vitalii-Dovgan said in [New Plugin] MultiReplace:

                      Maybe the same name in both places would be better?

                      Agree. Drop the “Npp” - it’s obvious the plugin is for Notepad++. You can name the repo “npp…” if you like, but the plugin DLL itself (and thus folder) should drop the “Npp” prefix.

                      Cheers.

                      1 Reply Last reply Reply Quote 2
                      • Alan KilbornA
                        Alan Kilborn
                        last edited by

                        Leading off a plugin name with Npp is a sure way to cause it to get visually lost to someone looking for it in the PluginsAdmin list: “Damn, I know it is called MultiReplace, how come I can’t find it? Oh, it’s because it is in the N’s because the dubious decision was made to put Npp on the front of its name…”

                        1 Reply Last reply Reply Quote 4
                        • Thomas KnoefelT
                          Thomas Knoefel @Vitalii Dovgan
                          last edited by

                          @Vitalii-Dovgan said in [New Plugin] MultiReplace:

                          Maybe the same name in both places would be better?

                          Good point, consistency matters. I’ve renamed project and files to ‘MultiReplace’ and dropped the ‘Npp’ prefix. Changes are in the new RC5 build.

                          wonkawillyW Alan KilbornA 2 Replies Last reply Reply Quote 5
                          • wonkawillyW
                            wonkawilly @Thomas Knoefel
                            last edited by wonkawilly

                            @Thomas-Knoefel said in [New Plugin] MultiReplace:

                            @Vitalii-Dovgan said in [New Plugin] MultiReplace:

                            Maybe the same name in both places would be better?

                            Good point, consistency matters. I’ve renamed project and files to ‘MultiReplace’ and dropped the ‘Npp’ prefix.

                            Excellent, this should be the standard way of naming all plugins: so they can be found alphabetically ordered into the Plugin Menu too.
                            Thank you.

                            rdipardoR 1 Reply Last reply Reply Quote 2
                            • rdipardoR
                              rdipardo @wonkawilly
                              last edited by

                              Excellent, this should be the standard way of naming all plugins: so they can be found alphabetically ordered into the Plugin Menu too.

                              The plugin’s file name does not determine the display name in the install menu; that comes from the "display-name" property in the JSON manifest embedded in the Plugins Admin DLL.

                              For example, selecting “F# Interactive” installs a module named NPPFSIPlugin.dll — with a pointless “-Plugin” suffix as well as prefix!

                              pl-admin--showing-short-name.png
                              prefixed-plugin-module

                              1 Reply Last reply Reply Quote 5
                              • Alan KilbornA
                                Alan Kilborn @Thomas Knoefel
                                last edited by Alan Kilborn

                                @Thomas-Knoefel said in [New Plugin] MultiReplace:

                                Changes are in the new RC5 build.

                                I realize that this is ‘release candidate’ stuff but…

                                I would guess from the size of the DLL in the “assets” that this is a “debug” build; you probably want to change this to a “release” build (forever more in all your releases of this plugin).

                                Should also consider a 32-bit build for our N++ family friends that use that one.

                                Thomas KnoefelT 1 Reply Last reply Reply Quote 3
                                • Thomas KnoefelT
                                  Thomas Knoefel @Alan Kilborn
                                  last edited by

                                  @Alan-Kilborn said in [New Plugin] MultiReplace:

                                  Should also consider a 32-bit build for our N++ family friends that use that one.

                                  All versions will ultimately be made available as “release” builds when plugin reaches 1.0.0.0 . I have updated RC5 now with all release builds. For all commits, I have an Action preparing the builds in the Git repository, which can be download here as well for the latest RC . (Kudos to @Michael-Vincent for his support with this.)

                                  1 Reply Last reply Reply Quote 4
                                  • Thomas KnoefelT
                                    Thomas Knoefel
                                    last edited by Thomas Knoefel

                                    This post is deleted!
                                    1 Reply Last reply Reply Quote 0
                                    • tomiskT
                                      tomisk
                                      last edited by

                                      It seems that regex replace with capture group ($1) doesn’t work. Would love to have this feature.

                                      PeterJonesP Thomas KnoefelT 2 Replies Last reply Reply Quote 0
                                      • PeterJonesP
                                        PeterJones @tomisk
                                        last edited by

                                        This post is deleted!
                                        1 Reply Last reply Reply Quote 0
                                        • Thomas KnoefelT
                                          Thomas Knoefel @tomisk
                                          last edited by Thomas Knoefel

                                          This post is deleted!
                                          1 Reply Last reply Reply Quote 1
                                          • Thomas KnoefelT
                                            Thomas Knoefel
                                            last edited by Thomas Knoefel

                                            I’ve recently completed the Scope Function for the MultiReplace plugin. It lets you set the area (or scope) for Find, Replace, and Marking. Here’s what’s new:

                                            Download Pre-Release here:

                                            @tomisk: Fix for capturing groups is include in this Pre-Release. Thanks for pointing it out,

                                            Selection Scope:

                                            • Supports single, multi, and rectangular selections.

                                            Column Scope:

                                            • Use the Replace, Find, and Mark functions within distcinct columns of delimited files. Plus, there’s an added highlight feature for these columns.
                                            • Just a note: The file remains editable, even when the plugin is importing a CSV structure.

                                            Marking Performance:

                                            From my observations, highlighting seems a bit slow in N++, especially when marking a large number of unique terms. Thus, I’ve modified the plugin to allow users to cancel the marking process if required.If you cancel and then make edits to unmarked columns, they’ll automatically get highlighted inplace, regardless of their position in the file.
                                            However, highlighting columns isn’t necessary for any operations. It primarily aids in visualization.

                                            DemoCSVMultiReplace.gif

                                            Thomas KnoefelT 1 Reply Last reply Reply Quote 5
                                            • First post
                                              Last post
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors