Community
    • Login

    [New Plugin] MultiReplace

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    97 Posts 12 Posters 101.6k Views 4 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.
    • Thomas KnoefelT Offline
      Thomas Knoefel @guy038
      last edited by

      Hi @guy038 ,

      to your question about the 8 logical processors: they don’t really matter here. The load threads do very little computing, they mostly wait for the key to deliver the next file. How many reads can usefully run at once depends on the drive, not on the CPU. That’s why auto picks the count by drive type: 4 for local drives like your key, 8 for network drives, where every file waits for the server, and 1 for hard disks, where parallel reads would just make the heads jump back and forth. On a key with a weaker controller, 8 could just as well be slower than 4. On yours it’s slightly faster, so feel free to keep it. 8 is also the maximum.

      One more thing: your first comparison showed 27 053 hits in the same 646 files, now it’s 27 010. Did anything change on the key in between?

      1 Reply Last reply Reply Quote 0
      • guy038G Offline
        guy038
        last edited by guy038

        Hi, @thomas-knoefel,

        Thanks for your explanations. As you said :

        How many reads can usefully run at once depends on the drive, not on the CPU

        Thus, the LoadThreads="auto" option, in the MultiReplace.ini file, globally means :

        • 1 thread, in case of hard disks drives

        • 4 threads, in case of local drives

        • 8 threads, in case of network drives

        BTW, how SSD drives are considered ? Like the HD drives case, I suppose ?


        Regarding the differences in results of the search, I certainly deleted some files between the October, 27 and the October, 30. I can’t remember !

        In the meanwhile, on November 1, I deleted an 890x64 folder and created a new 899x64 folder on my USB key. Thus, today, running again the 3 search engines ( N++, MultiReplace and Search++ ) within my local N++ v8.9.9 install, I get, this time :

        Search "Fi" (25 921 hits in 642 file(s)) [1 151 file(s) searched] for all regex engines

        Best Regards,

        guy038

        Thomas KnoefelT 1 Reply Last reply Reply Quote 0
        • Thomas KnoefelT Offline
          Thomas Knoefel @guy038
          last edited by

          Hi @guy038,

          your summary is right. By hard disks I meant the classic ones with spinning platters. SSDs get 4 threads, like your key. MultiReplace asks Windows whether a drive has a seek penalty, which only drives with moving read heads report. Those get 1 thread, CD/DVD drives too, and to be safe also USB disks that don’t answer that question.

          And thanks for checking the hit counts, good to see all three engines agree.

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

            MultiReplace 6.3 is out.

            Its main new feature is Mark Replacements: you see in the text what Replace All changed and what was there before, and you can put back single replacements or a whole passage without undoing the rest. Find/Replace in Open Documents can now also be limited to the tabs you colored in Notepad++.

            Download: Latest build

            Key Features & Improvements

            • Mark Replacements: Switch it on in the plugin menu, and after Replace All every replaced spot keeps a dotted underline and every deletion a small triangle. Hover a mark to see what was there before and which list entry made it.
            • Revert Replacement: Select a passage and right-click it, or right-click a single mark, and only that passage gets its original text back while all other replacements stay. The same menu steps from change to change and selects the list entry.
            • Tab Color Filter: Color the tabs you want in Notepad++, and Find/Replace in Open Documents can work on just those (Notepad++ 8.6.8 or later).
            • Selection Scope Frame: In Selection scope, a light frame shows the searched area while you step through the matches.
            • Column Highlight and Flow Tabs: Column highlight and sort state stay with their document when you switch tabs, and the Flow Tabs alignment is never saved or copied.
            • Add into List: New entries go to the end of the list, or to the top if you prefer, and scrolling to them can be turned off.
            • Other Plugins and Editor Themes: Marks stay visible and keep their colors next to plugins such as Columns++ and Search++, and the colors drawn into the text follow the editor theme.
            • Fixes from the review: The whole plugin went through a code review, the fixes are listed in the release notes.
            • Translations: Labels checked in all languages and scalings, and the Russian translation revised.

            Mark Replacements

            Mark Replacements

            Revert Replacements in a Selected Passage

            Tab Color Filter

            Tab Color Filter

            All changes are in the release notes.

            Issues or suggestions: GitHub

            Happy replacing!

            1 Reply Last reply Reply Quote 2
            • guy038G Offline
              guy038
              last edited by guy038

              Hello, @thomas-knoefel and All,

              For example, in the screenshot below, using these different search-replacements, against the text below, I got these search results !

              Notepad++ is a text editor and source code editor for use under Microsoft Windows. It support around 80 progamming languages with syntax highlighting and code folding. It allows working with multiple open files in a single window, thanks to its tabbed editing interface. Notepad++ is available under GPL and distributed as free software.
              
              
              Notepad++ is a text editor and source code editor for use under Microsoft Windows.
              bla
              bla blah
              It support around 80 progamming languages with syntax highlighting and code folding.
              It allows working with multiple open files in a single window, thanks to its tabbed editing interface.
              Notepad++ is available under GPL and distributed as free software.
              

              4ad8d13e-2730-4575-86c5-f73220450a7f-image.jpeg

              But, after clicking, on the Next Search Result, The cursor went, successively, right after :

              • The word 'Notepad++' only, in line 1
              • The word 'Notepad++' only, in line 4
              • The string 'aournd 80' only , in line 7
              • The word 'multiple' only, in line 8
              • The word 'Notepad++ only, in line 9
              

              Thus, if I’m not mistaken, I consider that the options Next Search Result and Previous Search Result should rather be labelled as Next Line Result and Previous Line Result ! May be, I’m miss something obvious !?

              On the contrary, when I subsequently ran a Replace All operation, the Next Replacement and Previous Replacement options did go, in turn, to the different replacements, particularly in case of several replacements in a same line !


              Now, in your documentation, within the Settings section, you said regarding the Find: Search from cursor position option :

              Find: Search from cursor position — If checked and Wrap around is off, “Find All”, “Replace All”, and “Mark Matches” start from the current cursor position. Runs over open documents or files never start at the cursor. If unchecked, operations always process the entire defined scope.

              So, if I understand you clearly, this behavior can be summarized in the table below :

              
              •================================•========================================•========================================•========================================•========================================•
                In Settings\Search and Replace | Find: Search from cursor position  ON  | Find: Search from cursor position  OFF | Find: Search from cursor position  ON  | Find: Search from cursor position  OFF |
                                               |                                        |                                        |                                        |                                        |
                        In MultiReplace dialog | Wrap around                        OFF | Wrap around                        OFF | Wrap around                        ON  | Wrap around                        ON  |
              •================================•========================================•========================================•========================================•========================================•
              | Find all                       |  From CURSOR location                  |  From START of file                    |  From START of file                    |  From START of file                    |
              •--------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•
              | Find in Docs                   |  From START of files                   |  From START of files                   |  From START of files                   |  From START of files                   |
              •--------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•
              | Find in Files                  |  From START of files                   |  From START of files                   |  From START of files                   |  From START of files                   |
              •--------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•
              | Replace All                    |  From CURSOR location                  |  From START of file                    |  From START of file                    |  From START of file                    |
              •--------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•
              | Replace in Docs                |  From START of files                   |  From START of files                   |  From START of files                   |  From START of files                   |
              •--------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•
              | Replace in Files               |  From START of files                   |  From START of files                   |  From START of files                   |  From START of files                   |
              •--------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•----------------------------------------•
              | Mark Matches                   |  From CURSOR location                  |  From START of file                    |  From START of file                    |  From START of file                    |
              •================================•========================================•========================================•========================================•========================================•
              

              And I’m really confused because these two options seem to serve the same purpose ! I probably misunderstood the underlying logic behind these two options. Please enlighten me on this !

              Best Regards,

              guy038

              Thomas KnoefelT 1 Reply Last reply Reply Quote 0
              • Thomas KnoefelT Offline
                Thomas Knoefel @guy038
                last edited by

                Hi @guy038,

                Hi guy,

                … I’m trying to. First, thanks for testing 6.3 so quickly. You found a bug and the settings description was not clear enough.
                Both points are fixed in this build.

                • Next/Previous Search Result now stop at every hit of a line. A double-click jumps to the hit you click on, and F4 / Shift+F4 go on from there. After a new search, F4 starts with its hits.
                • Your table is correct, the behavior stays as it is. The option is now called “Find All, Replace All, Mark: start at cursor”. A (?) next to it says when it applies: only with ‘Wrap around’ off, and not for runs over open documents or files. Does it make it clear or more confusing?

                The two options don’t serve the same purpose, though. ‘Wrap around’ is for stepping from hit to hit. The other option decides where Find All, Replace All and Mark start. With the option on and ‘Wrap around’ off, they start at the cursor, like Replace All in Notepad++. Everyone can choose what suits them. By default, All means all, not from the cursor, whatever ‘Wrap around’ says.

                If everything works for you, I will add this to 6.3.1.

                1 Reply Last reply Reply Quote 0
                • guy038G Offline
                  guy038
                  last edited by guy038

                  Hi, @thomas-knoefel and All,

                  First of all, I’d like to apologize for not congratulating you for this important release, in my previous post !


                  I confirm that, with your new build, the search does go though all the matches and not only to the first hit of the lines. Nice !

                  You said in your last post ::

                  A double-click jumps to the hit you click on, and F4 / Shift+F4 go on from there. After a new search, F4 starts with its hits.

                  And in your documentation, you also said :

                  Additionally, three navigation commands are available from the Plugins > MultiReplace menu and can be assigned to custom keyboard shortcuts via Settings > Shortcut Mapper > Plugin Commands:

                  But adding the F4 and Shift + F4 shortcuts for your two commands, Next Search Results and Previous Search Results, via the Shortcut Mapper has the drawback of triggering the message CONFLICT FOUND

                  Could you, like @coises, to insert these shortcuts within your code ? For example, with the Search++ plugin :

                  • After you ran the Plugins > Search++ > Search... option, then the Ctrl + F shortcut opens the Search in Files window of the plugin

                  • But if you switch back to the current document, a Ctrl + F shortcut opens the usual N++ Find dialog

                  Using this way allows simultaneous shortcuts in both plugin and native N++. No need to use the Shortcut Mapper !


                  You said :

                  The option is now called “Find All, Replace All, Mark: start at cursor”. A (?) next to it says when it applies …

                  In this new build, I did see the (?) indication which shows the calltip Only when 'Wrap around' is off and not for runs over open documents of files.

                  However, I did not see the new mane of the option Find All, Replace All, Mark: start at cursor but still the old name Find: Search from cursor position

                  Note that I downloaded the MultiReplace-Release-x64.zip archive. I don’t know if this matters !


                  To my mind, the best is to always check this option in MultiReplace > Settings... > Search and Replace dialog. In this case :

                  • When the Wrap around option is not checked, process goes from cursor position to end of file

                  • When the Wrap around option is checked, process goes from the beginning of current file to its end


                  You can verify this assumption, using the regex (?s)^xyz.+|^abc.+ against this text :

                  This is
                  a test
                  abc
                  with some text
                  to see
                  xyz
                  if everything
                  works properly
                  
                  • Place the caret at beginning of the 5th line to see

                  • When the Wrap around option is OFF, a Replace All action, with Notepad++ or MultiReplace, deletes the third last lines ONLY

                  • When the Wrap around option is ON, a Replace All action, with Notepad++ or MultiReplace, deletes everything from string abc in 1 replacement

                  This clearly shows that the process goes from the very start of file when the Wrap around option is checked !

                  If the process would have started from current position, then started again from beginning of file, once the end reached, we shoud have gotten the N++ message : Replace All: 2 occurrences were replaced in entire file ( first, using the (?s)^xyz.+ regex and then, using the (?s)^abc.+ regex )

                  Best Regards,

                  guy038

                  Thomas KnoefelT 1 Reply Last reply Reply Quote 0
                  • Thomas KnoefelT Offline
                    Thomas Knoefel @guy038
                    last edited by Thomas Knoefel

                    Hi @guy038 ,

                    Hi guy,

                    thanks a lot, and no need to apologize! There have already been so many important releases ;-)

                    The archive from GitHub Actions only contained MultiReplace.dll, so your old languages.ini still showed the old name. The text of the (?) is new, that’s why you already saw it in English. From now on languages.ini is part of the build. Here is the new build.

                    Your test is right. Here MultiReplace deliberately differs from Notepad++: it was designed for mass replacement, and there it’s the more natural choice that All covers the whole text by default. The option is there for everyone who prefers the Notepad++ way.

                    Good idea with F4, it’s in this build. F4 / Shift+F4 now work directly in the Search Results window, like in Search++, without the Shortcut Mapper, and the focus stays there. In the document, F4 keeps its Notepad++ meaning. If you assigned F4 / Shift+F4 to MultiReplace in the Shortcut Mapper, you can remove that again, which also clears the conflict.

                    1 Reply Last reply Reply Quote 1
                    • guy038G Offline
                      guy038
                      last edited by guy038

                      Hi, @thomas-knoefel and All,

                      Thanks for this new build. The messages, in Settings, are indeed updated


                      When I first opened the MultiReplace, I was surprised to not see the shortcuts F4 and Shift + F4 next to their labels !. Then I switched to the test file, below :

                      Notepad++ is a text editor and source code editor for use under Microsoft Windows. It support around 80 progamming languages with syntax highlighting and code folding. It allows working with multiple open files in a single window, thanks to its tabbed editing interface. Notepad++ is available under GPL and distributed as free software.
                      
                      
                      Notepad++ is a text editor and source code editor for use under Microsoft Windows.
                      bla
                      bla blah
                      It support around 80 progamming languages with syntax highlighting and code folding.
                      It allows working with multiple open files in a single window, thanks to its tabbed editing interface.
                      Notepad++ is available under GPL and distributed as free software.
                      

                      And again, actions on F4 or Shift + F4 did not move the caret to next / previous move ?

                      Then, I understood that these shortcuts are ONLY active when focus in on the MultiReplace - Seardh Results dialog !

                      Then after a N++ restart, I verified that a N++ Find All operation of the Notepad\+\+ string allows the F4 and Shift + F4 shortcuts to act on, both, the Search results panel and the current document and move between the differents strings Notepad++ !

                      However, I would totally understand that the possibility to allow these two shortcuts, within the current document of the Search results panel, could be rather difficult to implement !

                      BTW, I noticed that it’s better to not use, simultaneously, a N++ Find all operation and a MultiReplace Find All one. Some weird behavior may occur, in this case !

                      Best Regards,

                      guy038

                      Thomas KnoefelT 1 Reply Last reply Reply Quote 0
                      • Thomas KnoefelT Offline
                        Thomas Knoefel @guy038
                        last edited by

                        Hi @guy038,

                        thanks for testing again!

                        Yes, F4 and Shift+F4 only work while the focus is in the MultiReplace Search Results window. That’s on purpose: in the editor, F4 and Shift+F4 belong to the Search results of Notepad++ itself. I don’t want to use a keyboard hook or any other trick to take them away from Notepad++, both results windows should work side by side. That’s also why there’s no F4 next to the menu entries.

                        If you want to step through the MultiReplace results from the editor, give Next Search Result and Previous Search Result (Plugins > MultiReplace) a free shortcut in Settings > Shortcut Mapper > Plugin commands. If you prefer F4 and Shift+F4 for them, you first have to remove these keys from Next Search Result and Previous Search Result of Notepad++ in the Main menu tab, otherwise Notepad++ keeps them.

                        About using the Find All of Notepad++ and of MultiReplace at the same time: what exactly did you see? A few steps to reproduce it would help me a lot.

                        1 Reply Last reply Reply Quote 0

                        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