Community
    • Login

    Search++: A work in progress

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    45 Posts 7 Posters 1.9k 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.
    • guy038G
      guy038
      last edited by guy038

      Hello, @coises,

      You said :

      When the search dialog is narrow (typical if the docking dialog is used and docked to the left or right), the status message can overflow the available space. I added ellipsis to the message and a balloon tip on hover to show the whole message when it overflows.

      Could you share a screenshot that illustrates this behavior as I have not been able, so far, to see any ellipsis char and any ballon tip !


      Now, is this a bug or I did not understand the logic ?

      Let’s suppose this text in a new tab :

      This is a test
      This is a test
      This is a test
      
      This is a test
      This is a test
      This is a test
      
      • Move to this new tab

      • Put the caret on the 4th empty line, without selecting anything else ( IMPORTANT )

      • Run Plugins> Search++ > Search...

      • Select the Plain button

      • SEARCH is

      • Check the Match case option ONLY

      • Click on the ▼ mark of the Find All button

      • Choose the Select > Select Before in Whole Document or the Select Before option

      => No message and no matches ??

      I was rather expecting the message Selected 6 matches before current position

      • Replace the caret on the 4th empty line , without selecting anything else ( IMPORTANT )

      • Click on the ▼ sign of the Find All button

      • Choose the Select > Select After in Whole Document or the Select After option

      => Any is string is matched in entire document

      => Message : Selected 12 matches after selection ??

      I was rather expecting the message Selected 6 matches after current position

      Finally :

      • Replace the caret on the 4th empty line , without selecting anything else ( IMPORTANT )

      • Click on the ▼ sign of the Find All button

      • Choose the Select > Select in Whole Document option

      => Any is string is matched in entire document

      => Message : Selected 12 matches

      This time, the results are coherent !


      Now, @coises, to my mind, it would be interesting to change the layout, below :

      Find ▼    Count ▼    Find All ▼
      
      □ Match Case    □ Whole word only
      

      By this one :

      Find ▼    Count ▼    Find All ▼
      
      Select ▼    Mark ▼    Show ▼
      
      □ Match Case    □ Whole word only
      

      In addition, this would give some more default values available for the Select, Mark and Show options ! What are your thoughts on this ?


      A nice thing regarding the Search Mark feature is that you can use the native N++ Mark feature to perform additional actions :

      • You may clear all marked text with the Clear all marks button. Of course, you can simply use the Tools > Unmark All Text of Search++

      • You can use the Copy Marked Text of the Mark dialog. But, while trying to get a Search++ equivalent behavior, I suspected an other bug :((

      Let’s use this text in a new tab

          This program is free software: you can redistribute it and/or modify
          it under the terms of the GNU General Public License as published by
          the Free Software Foundation, either version 3 of the License, or
          (at your option) any later version.
      
      • Move to this new tab

      • Run Plugins> Search++ > Search...

      • Select the Regex button

      • SEARCH ^.+

      • Click on the ▼ sign of the Find All button

      • Choose the Select > Select in Whole Document option

      => The 4 lines are selected

      Then, in order to mimic the Copy Marked Text button, you just have to do a Ctrl + C action. So OK, so far !

      • Now, click anywhere to cancel the selection

      • Select this ABCDE string

      • Copy in the clipboard with a Ctrl + C action

      • Move to the new tab

      • Run Plugins> Search++ > Search...

      • Select the Regex button

      • SEARCH ^.+

      • Click on the ▼ sign of the Find All button

      • Choose the Mark > Mark in Whole Document option

      => The 4 lines are marked

      -Then use the Tools > Marked text → Selections option

      => The 4 lines are ALSO selected

      • Run a Ctrl + C action to put this selection in the clipboard

      • Then, run a Ctrl + V action => The clipboard wrongly contains the string ABCDE

      So, despite of the Tools > Marked text → Selections action, nothing can be copied !?


      Regarding the marked strings, you probably know that you can go through all of them with the Ctrl + 0 and Ctrl + Shift + 0 shocrtcuts on main keyboard ( Refer to the Search > Jump Up > Find Mark Style and Search > Jump Down > Find Mark Style options )

      And indeed, a Ctrl + 0 action moves to the next marked text, whatever that the mark operation was due to Notepad++ or Search++

      Unfortunately, a Ctrl + Shift+ 0 action does not move to the previous marked text :-(( Could you confirm, @coises ?

      However, note that commands Ctrl + 1 to Ctrl + 5 and Ctrl+ Shift + 1 to Ctrl + Shift + 5, to navigate between marked strings, work as expected if you change the Marked Style in Settings accordingly.


      Last thing :

      In the Tools menu, I noticed that the Unmark All Text button ONLY clears hhe marked text which is presently defined in the Settings dialog

      So, you could, either :

      • Add a color to identify which marked text will be cleared

      • Simply clears any marked text whatever its style

      • Change the single option :

      □ Unmark all text
      

      in the two options :

      □ Unmark present styled text
      
      □ Unmark all styled text
      

      Best Regards,

      guy038

      CoisesC 3 Replies Last reply Reply Quote 2
      • CoisesC
        Coises @guy038
        last edited by Coises

        @guy038 said in Search++: A work in progress:

        Could you share a screenshot that illustrates this behavior as I have not been able, so far, to see any ellipsis char and any ballon tip !

        4d6cdd85-1d61-4009-a037-36a6c9b4ce3f-image.png

        Now, is this a bug or I did not understand the logic ?
        […]
        => No message and no matches ??

        That is a bug. It should work the same as Mark Before and Mark After. Thank you for catching and reporting it. I’ll fix it.

        Now, @coises, to my mind, it would be interesting to change the layout, below :
        […]
        In addition, this would give some more default values available for the Select, Mark and Show options ! What are your thoughts on this ?

        I’m concerned about increasing the minimum size of the dialog and about making it too busy/cluttered. I won’t say I won’t consider it, but… I’m hesitant. It could be an option to add extra buttons, I suppose — the plugin already manages three layouts (horizontal, vertical and wide, the latter being for docking at the top or bottom), I suppose it could manage six (each existing layout in either 5-command-button or 8-command-button form). I’m not saying never… but not now.

        -Then use the Tools > Marked text → Selections option

        => The 4 lines are ALSO selected

        • Run a Ctrl + C action to put this selection in the clipboard

        • Then, run a Ctrl + V action => The clipboard wrongly contains the string ABCDE

        After clicking on a button in a dialog, keyboard focus is on the button. (That’s standard Windows behavior, which I have not attempted to change in this case.) Your Ctrl+C went to the button. You needed to return focus to the document (e.g., Ctrl+N) before you could copy the selection.

        I admit this focus thing is an annoyance, but I think it would get even more confusing if I overrode Windows standard behavior in a dozen special cases by putting the focus where I think the user will want it next. (I did it with Select commands, but I’m not even sure that’s a good idea. How many exceptions to normal Windows behavior should I expect users to remember? At what point does keeping track of all the exceptions become more difficult than just keeping track of the focus?)

        Unfortunately, a Ctrl + Shift+ 0 action does not move to the previous marked text :-(( Could you confirm, @coises ?

        I can confirm, and I also see that the same thing happens with text marked using the Mark tab of the built-in search dialog. Search | Jump Up | Find Mark Style does work, but the Ctrl+Shift+0 shortcut does not.

        If I change the shortcut to Ctrl+Shift+M, it works. Further testing suggests that Ctrl+Shift+0 does not work as a shortcut when assigned to any command. I haven’t yet checked to see if this is a known issue, or whether it persists without any plugins.

        In the Tools menu, I noticed that the Unmark All Text button ONLY clears hhe marked text which is presently defined in the Settings dialog

        So, you could, either :

        • Add a color to identify which marked text will be cleared

        • Simply clears any marked text whatever its style

        • Change the single option :

        I see your point. The wording suggests that it will remove all marks of any kind, not just the mark style Search++ is using.

        Notepad++ treats Find Mark Style differently than the other styles; Search | Clear Styles | Clear all Styles clears styles 1-5, but not the Find Mark Style. (The only way I know to clear that in native Notepad++ is in the Mark dialog.) So there isn’t true Clear All Styles already. (Beyond that, I might add a custom style, like Columns++ uses; I haven’t decided yet if that would be advantageous — having something that doesn’t overlap with anything Notepad++ uses — or just an unnecessary complication.)

        I’m pretty sure I will want to stay with the notion that the normal way to use Search++ will be to pick a mark style and stick with it, so any time Search++ refers to a “mark” it means “a mark in the style selected in the settings dialog.” So I don’t really want to introduce any options that break that model by affecting styles other than the one selected.

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

          In regards to:

          Further testing suggests that Ctrl+Shift+0 does not work as a shortcut when assigned to any command. I haven’t yet checked to see if this is a known issue

          Maybe see this:
          https://community.notepad-plus-plus.org/post/90173
          or some of the other postings about Ctrl+Shift+0 in that topic.

          CoisesC 1 Reply Last reply Reply Quote 3
          • CoisesC
            Coises @Alan Kilborn
            last edited by

            @Alan-Kilborn said in Search++: A work in progress:

            In regards to:

            Further testing suggests that Ctrl+Shift+0 does not work as a shortcut when assigned to any command. I haven’t yet checked to see if this is a known issue

            Maybe see this:
            https://community.notepad-plus-plus.org/post/90173
            or some of the other postings about Ctrl+Shift+0 in that topic.

            Thank you, Alan. Good that someone still has memory cells working. (@guy038 and I were both in that discussion, and it seems neither of us remembered.)

            Similar to what it sounds like happened to Guy in that thread, I attempted to reset all shortcuts for keyboard languages to None even though they already were all None, except for the last one, which had Ctrl+Space associated with something to do with IME and Chinese (probably came about when I was testing Columns++ search in double byte character sets). I changed it to None (repeatedly), but it changed itself back as soon as I OK’d the change.

            None-the-less, even though no visible setting has changed, now Ctrl+Shift+0 works. No rhyme or reason to this corner of Windows, it seems. :-(

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

              Hi, @alan-kilborn, @coises and All,

              Many thanks @alan-kilborn, for solving the Ctrl + Shift + 0 not working at all ;-)) I completely forgot this old post. Like @coises, I confirm that your memory cells are working perfectly !

              So, certainly, on my Windows 10 laptop, with your precious advice, I was able to solve this bug, in October 2023. But, it happens that I migrated my laptop to Windows 11, at the end of October 2025. And I supposed that this migration reset a lot of parameters, whose this one !

              Thank you again for helping us find the right post !

              Best Regards,

              guy038

              1 Reply Last reply Reply Quote 1
              • CoisesC
                Coises @guy038
                last edited by

                @guy038 said in Search++: A work in progress:

                -Then use the Tools > Marked text → Selections option

                => The 4 lines are ALSO selected

                Run a Ctrl + C action to put this selection in the clipboard
                
                Then, run a Ctrl + V action => The clipboard wrongly contains the string ABCDE
                

                So, despite of the Tools > Marked text → Selections action, nothing can be copied !?

                I wrote:

                After clicking on a button in a dialog, keyboard focus is on the button. (That’s standard Windows behavior, which I have not attempted to change in this case.) Your Ctrl+C went to the button. You needed to return focus to the document (e.g., Ctrl+N) before you could copy the selection.

                That is true, but there is also a flaw in Marked text → Selections that causes an extra, empty selection to be included at the beginning, which could cause unexpected results when pasting.

                A new version will be coming, but probably not until sometime tomorrow. Thank you for all your feedback.

                1 Reply Last reply Reply Quote 2
                • CoisesC
                  Coises @guy038
                  last edited by

                  @guy038 said in Search++: A work in progress:

                  • Choose the Select > Select Before in Whole Document or the Select Before option

                  => No message and no matches ??

                  […]

                  -Then use the Tools > Marked text → Selections option

                  => The 4 lines are ALSO selected

                  • Run a Ctrl + C action to put this selection in the clipboard

                  Version 0.5.1 fixes the Before/After bug and adds some new commands to the Tools button menu; Copy Marked Text should avoid the need to make a selection from marked text just to copy it.

                  There are a few other small changes that hopefully are improvements.

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

                    Hello @alan-kilborn, @Coises and All,

                    Yesterday, I was pretty sure the bug had been fixed. Unfortunately, today, perhaps because I needed to re-start my laptop for other reasons, the bug is still here !

                    • Of course, I re-ran the @alan-kilborn’s solution but without success

                    • I tried to delete then re-assign the Ctrl + Shift + 0 shortcut to the Previous style of Find Mark style command within N++ => Not better

                    • I turned my laptop off and then back on but no chance, either

                    • I also visit the two sites, below, to get some tools to deternine which process could own the Ctrl + Shift + 0 shortcut => No result

                    https://www.nirsoft.net/utils/hot_keys_list.html

                    https://github.com/ITachiLab/hotkey-detective

                    Note that once Hotkeydetective.exe has been launched with administator rights, it is said to press the stolen key in order that the software shows you a path to the guilty process. However, hitting the Ctrl + Shift + 0 shortcut does not show any line, personally !


                    Finally, I had the idea of simply changing the Ctrl * Shift + 0 shortcut to Ctrl * Shift + 6. And… bingo, this change worked nicely !

                    Thus, doing the same thing for the Ctrl + 0 shortcut seems a possible solution to this problem !

                    BR

                    guy038

                    P.S. :

                    After using this work-around, I tried to assign the Ctrl + Shift + 0 shortcut to a command without shortcut, like the View > Summary... command. But it does not show the Summarize dialog :-((

                    In contrast, the shortcut Ctrl + 0, which is no longer used, displays the control character 0, as I did not check the Settings > Preferences... > Editing2 > Prevent control character (C0 code) typing into document option. Thus no need of the Control Panel feature in order to type the NUL character anymore !

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

                      Hello, @coises,

                      First, thanks for the Select Before/After fix ! Now, the new Copy Marked Text options, with the separator choice, are really practical and straightforward

                      Regarding the Tools > Select Marked Text option ( formely Marked text → Selections ), we need to do a Ctrl + N action, to replace focus on current document first, before doing a Ctrl + C action


                      Regarding the Enhance clearing behavior, I suppose that you mean :

                      • If current document already contains some selections, based on a previous search

                      OR

                      • If current document already contains some marked text, based on a previous search

                      OR

                      • If current document already contains some invisible lines and some visible lines, based on a previous search

                      => The appearance of current document does not changed if present search does not find any match ( => previous selections are kept, previous marks are kept and no other lines are hidden )

                      Of course, this makes sense !


                      This still one point that’s a bit unclear to me : what is the fundamental difference between all these options, when compared in pairs :

                      Find                         vs        Find in Whole Document
                      Find Backward                vs        Find Backward in Whole Document
                      
                      
                      Count                        vs        Count in Whole Document
                      Count Before                 vs        Count Before in Whole Document
                      Count After                  vs        Count After in Whole Document
                      
                      
                      Find All Before              vs        Find All Before in Whole Document
                      Find All After               vs        Find All After in Whole Document
                      
                      Select Before                vs        Select Before in Whole Document
                      Select After                 vs        Select After in Whole Document
                      
                      Mark Before                  vs        Mark Before in Whole Document
                      Mark After                   vs        Mark After in Whole Document
                      
                      Show Before                  vs        Show Before in Whole Document
                      Show After                   vs        Show After in Whole Document
                      
                      
                      Replace and Find             vs        Replace And Find in Whole Document
                      Replace and Find Backward    vs        Replace and Find Backward in Whole Document
                      
                      Find or Replace              vs        Find or Replace in Whole Document
                      Find Backward or Replace     vs        Find Backward or Replace in Whole Document
                      
                      
                      Replace All                  vs        Replace All in Whole Document
                      Replace All Before           vs        Replace All Before in Whole Document
                      Replace All Aftrt            vs        Replace All After in Whole Document
                      

                      Best Regards,

                      guy038

                      CoisesC 1 Reply Last reply Reply Quote 1
                      • CoisesC
                        Coises @guy038
                        last edited by Coises

                        @guy038 said in Search++: A work in progress:

                        This still one point that’s a bit unclear to me : what is the fundamental difference between all these options, when compared in pairs :

                        The principle (see the last bullet point under help for search scopes) is that commands which don’t specify a scope search in marked text if there is any; otherwise, in the current selection if it is not empty; otherwise, in the whole document. That’s subject to the Settings: if you unchecked both Automatically search within selections and Automatically search within marked text, then all the pairs of commands you listed would be identical; and there are the limits on when selections are considered “large enough” to trigger search within selection. (A selection that is the immediate result of a stepwise search never causes the same search to search within that selection no matter how large it is.)

                        There are two special cases, and a third questionable feature, also involved:

                        1. There are no Before or After commands with in Selection scope. (My logic is that something can’t be both in the selection and before or after it.) So search commands that include Before or After can only be in Marked Text or in Whole Document.

                        2. Mark commands that don’t specify a scope don’t automatically scope to in Marked Text even if Automatically search within marked text is enabled. What happens is that unless you’ve checked Always unmark all text before Mark command, default Mark commands add to existing marks. I know this is a different behavior from selections, but I think because selections are so volatile, and marks are not, it is natural to use them in different ways. Should this exception be an option in Settings? I’m inclined to add it as a default-checked sub-option of Automatically search within marked text.

                        3. Search commands that specify in Selection or in Marked Text search the whole document if there is no (non-empty) selection or marked text. I’m questioning the sense of that now. I’m thinking that if the user specifies “in selection” or ”in marked text,” and there is none, the search should fail with a message like “No marked text to search” rather than silently discarding the specified scope.

                        Thoughts about that logic, especially point 3 (which I am inclined to change in the next release) are welcome and encouraged.


                        I have tried to keep as much “symmetry” as I could, to make it all more comprehensible. I think it is possible that I have created some nonsense in practice.

                        Points 1 and 3 together mean that Before and After commands without a scope are either the same as Before/After in Marked Text if Automatically search within marked text is checked, or the same as Before/After in Whole Document if it isn’t. However, as I wrote, I’m questioning point 3; without that, when the relevant setting is checked, there would be a difference (the commands that don’t specify a scope would switch between in Marked Text and in Whole Document depending on whether there was any marked text in the document, whereas neither command that specified one scope would switch to the other).

                        So… looking at the full list you gave, group by group, assuming default settings… this is what is supposed to happen (full testing of every possible case has not been done):

                        Find                         vs        Find in Whole Document
                        Find Backward                vs        Find Backward in Whole Document
                        

                        The two on the left will find the next match in marked text following or preceding the current position or selection if any text is marked; otherwise they will find the first or last match in the selected text if “enough” text is selected; otherwise they will find the next match following or preceding the current position or selection in the whole document. Those on the right will always find the next match following or preceding the current position or selection in the whole document regardless of whether any text is marked or selected.

                        Count                        vs        Count in Whole Document
                        

                        Count will count only matches in marked text if any text is marked; otherwise it will count only matches in selected text if “enough” text is selected; otherwise it will count all matches in the whole document. Count in Whole Document will always count all matches in the whole document regardless of whether any text is marked or selected.

                        Count Before                 vs        Count Before in Whole Document
                        Count After                  vs        Count After in Whole Document
                        

                        The two on the left will count only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will count matches before or after the current position or selection in the whole document. Those on the right will always count matches before or after the current position or selection in the whole document regardless of whether any text is marked.

                        Find All Before              vs        Find All Before in Whole Document
                        Find All After               vs        Find All After in Whole Document
                        

                        The two on the left will list only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will list all matches before or after the current position or selection in the whole document. Those on the right will always list all matches before or after the current position or selection in the whole document regardless of whether any text is marked.

                        Select Before                vs        Select Before in Whole Document
                        Select After                 vs        Select After in Whole Document
                        

                        The two on the left will select only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will select all matches before or after the current position or selection in the whole document. Those on the right will always select all matches before or after the current position or selection in the whole document regardless of whether any text is marked.

                        Mark Before                  vs        Mark Before in Whole Document
                        Mark After                   vs        Mark After in Whole Document
                        

                        I’ll double-check my logic later, but I think these are identical, since (1 above) Before/After can’t be in selection, and (2 above) Mark doesn’t automatically scope to marked text. It’s unclear to me which ones to remove, since either choice breaks the symmetry and could be confusing to users, but having two commands that do the same thing is also confusing.

                        Show Before                  vs        Show Before in Whole Document
                        Show After                   vs        Show After in Whole Document
                        

                        I grant that this would be a strange use of Show. In the circumstance where there are hidden lines both before and after the current position or selection, and there is some marked text in document, the ones on the left would search only marked text before or after the current position or selection for lines to unhide, while the ones on the right would search all text.

                        Replace and Find             vs        Replace And Find in Whole Document
                        Replace and Find Backward    vs        Replace and Find Backward in Whole Document
                        
                        Find or Replace              vs        Find or Replace in Whole Document
                        Find Backward or Replace     vs        Find Backward or Replace in Whole Document
                        
                        Replace All                  vs        Replace All in Whole Document
                        Replace All Before           vs        Replace All Before in Whole Document
                        Replace All After            vs        Replace All After in Whole Document
                        

                        These are like their Find and Find All counterparts. The ones on the left work like “in Marked Text” if any text is marked; otherwise, like “in Selection” if “enough” text is selected; otherwise like “in Whole Document” (like the ones on the right).

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