Community
    • Login

    Search++: A work in progress

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    154 Posts 9 Posters 48.7k Views 3 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.
    • CoisesC Offline
      Coises @guy038
      last edited by

      @guy038 said:

      Thank you for all your time looking at this and processing my rambling ideas. A couple answers to this part:

      I suppose it would be worth to add, in the documentation, that, after pressing the ▼ key, at the rightmost part of the Search++ dialog , before the options :

      • Hitting the F key runs the default Find All operation

      • Hitting the S key runs the default Selection operation

      • Hitting the M key runs the default Mark operation

      • Hitting the H key runs the default Show operation

      Noted. I can add more details about keyboard navigation. The big problem, though, is that there is no straightforward way to navigate to that down arrow menu (or any of the other split button menus) by keyboard. And I still haven’t thought of a good way to make it work.

      Regarding the general problem about focusing within the plugin dialog or within the current document, I don’t bother about it.

      Good to know that what I have so far is comprehensible and working as intended. The default for Focus the document after stepwise Find and Replace commands is unchecked, which as you explain is likely to be less confusing than checked.

      You said, in the first of of last three consecutive pôsts :

      For multiple document searches, the completion message (e.g., “Found 12 matches in 7 of 9 open documents.” or “No matches found in 5 open documents.”) could include that some (or all) documents were skipped because the find string includes characters inconsistent with the documents’ encoding. Something similar could be added to Find in Files.

      I agree to add these messages which give extra inormation on the current search !

      Noted. I will probably attempt it only for Plain text searches first, as it is easier for plain text. (No need to figure out which characters it can’t match without: it needs all of them!)

      On the other hand, in your previous loooong post, you said :

      3-4 Would it be better to show it on the buttons and remove the ability to select an action with other than default scope as the action for a button by shift-clicking the drop-down menu? Does anyone even realize they can shift-click the drop-down menus (the only way to know is to do it by accident or read the help)?

      And I answered :

      Personally, I’m rather in favor of your last point. That way, we would know exactly which operation has just been performed, and it would be really helpful when pressing the Search button , at the rightmost zone of the Search++ panel — which would clearly indicate whether we’ve selected and run : a list, a selection, a mark, or just the results of a search !

      I do know about using the Shift key and a click on any drop-dwon menu. However, what is your general feeling about my reply : any operation would be clearly identified and affecting a default option would not been anymore mandatory ?!

      I have a feeling we are not communicating on this one. I can’t quite figure out what you mean, and I suspect what I wrote didn’t convey what I intended. I’ll address this in a separate post.

      You also said in the same post :

      4 Figure out how to modify Boost.regex to get rid of the dreaded “complexity” message. Make progress responsive during a search (not just between finds, as it is now: Boost.regex as built has no progress callback, so you can only estimate progress after it succeeds or fails to find a match, not while it’s working) and let the user cancel if it’s taking too long.

      And I answered :

      I do not think this point is essential. Check out my post at https://community.notepad-plus-plus.org/post/106252. Apparently, for certain regular expression searches, this specific message, about complexity, may appear (even though the result is correct) when the scanned file contains an average number of lines, with nice results for smaller files and an error for big files !

      Did you already tried to test the regex proposed in that post and did you deduce some facts ? I didn’t even think it was possible to get a correct result while seeing a message telling you that the current search is incorrect !!

      It isn’t possible without changing Boost.regex. The code for Boost.regex is open source. What I’m considering would amount to “forking it” to change two things:

      1. The complexity message occurs when a heuristic in the Boost.regex code estimates that “too much” text is being reexamined while “too little” progress is being made in moving the initial match point forward. It is important to understand that this is not testing for something like memory exhaustion which would crash the program, it’s merely making a guess as to whether the supplied regular expression is one that will never complete (or will take a ridiculously long time). I would want to remove that test entirely and let the user decide when it’s taking too long and making too little progress.

      2. Boost.regex needs that because it has no means of reporting progress or canceling searching before it either finds the next match or finds that there are no more matches. So if you’re searching a large file for something that is near the end, Boost.regex doesn’t let you visualize how the search is proceeding. (The only time we see progress is as each one of multiple matches is found.) There is also no clean way to cancel a search for the next match until it either succeeds or fails. I would want to add a callback that would let the calling program monitor progress and cancel at user request.

      I listed this because it’s one of my eventual goals, but I do wonder whether people care much. I haven’t tried to do it yet. My plan is to get to a “1.0” version of Search++ before I work on that. There are a couple other things that would probably involve modifying Boost.regex code (Unicode word boundaries and more complete implementation of Unicode properties) which I also am considering, but will likely not attempt until after a 1.0 version.

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

        Hello, @coises,

        Regarding this specific point :

        3-4 Would it be better to show it on the buttons and remove the ability to select an action with other than default scope as the action for a button by shift-clicking the drop-down menu? Does anyone even realize they can shift-click the drop-down menus (the only way to know is to do it by accident or read the help)?

        May be I expressed my choice very badly ! Actually, I just wanted to say that the changes in the appearance of the various buttons ( Find, Count, Find All, Replace, Replace All )— which occur when you hold down the Shift key while clicking a button — would be visible immediately, in future releases, just by selecting the desired option, without needing to hold down the Shift key. Does this wording make more sense to you ?

        BR

        guy038

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

          @guy038 said:
          Regarding this specific point :

          3-4 Would it be better to show it on the buttons and remove the ability to select an action with other than default scope as the action for a button by shift-clicking the drop-down menu? Does anyone even realize they can shift-click the drop-down menus (the only way to know is to do it by accident or read the help)?

          May be I expressed my choice very badly ! Actually, I just wanted to say that the changes in the appearance of the various buttons ( Find, Count, Find All, Replace, Replace All )— which occur when you hold down the Shift key while clicking a button — would be visible immediately, in future releases, just by selecting the desired option, without needing to hold down the Shift key. Does this wording make more sense to you ?

          I see. I think I follow what you’re suggesting, but I have to admit I don’t like it. I don’t think selecting a function from the drop-down should always make that the new one-click action for the button.

          However… it could be an option. Enabling a setting like Buttons automatically change to last drop-down action would reverse the meaning of the Shift key, so that when you click an action in the drop-down menu it becomes the new action on the button, and you have to Shift+click if you don’t want that to happen.

          Is that what you mean? Seems like a good idea. Thanks.

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

            Hi, @coises,

            Yes, I suppose that a new option could be a nice solution. However, could you mention the SHIFT key in this option : something like, for example :

              □ Buttons reflect last drop-down action, without SHIFT key
            

            So :

            • If this option is enabled, a simple click would change the appearance of buttons and Shift + click would keep their appearance unchanged

            • If this option is disabled, a Shift + click would change the appearance of buttons and a simple click would keep their appearance unchanged

            BR

            guy038

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

              I had written:

              In the main search dialog, when the default action is active for a button (e.g., Find, Count, etc. without a scope qualification like “in Selection” or “in Marked Text”), somehow indicate what the default action would be if you pressed the button right now. That is, Find adapts to work in selection if you have a selection large enough, or in marked text, or in the whole document, but what will it actually do right now? This feels like a big missing thing to me, but I’m a bit stumped as to how to indicate it.

              • If a put a general indicator somewhere (it will always be the same for all buttons with default scope), where, and how should it appear? I am very hesitant to take up additional space in the dialog, or to make it any more “busy” than it already is.
              • If I show it on each button, how would I distinguish it from the marker that tells you the direct action for the button is a command with a specified scope? (Remember, this has to work for any dark mode color combination the user might pick, and some users are colorblind.)
              • Would it be better to show it on the buttons and remove the ability to select an action with other than default scope as the action for a button by shift-clicking the drop-down menu? Does anyone even realize they can shift-click the drop-down menus (the only way to know is to do it by accident or read the help)?

              @guy038 wrote:

              Personally, I’m rather in favor of your last point. That way, we would know exactly which operation has just been performed, and it would be really helpful when pressing the Search button , at the rightmost zone of the Search++ panel — which would clearly indicate whether we’ve selected and run : a list, a selection, a mark, or just the results of a search !

              and later, @guy038 wrote:

              I do know about using the Shift key and a click on any drop-dwon menu. However, what is your general feeling about my reply : any operation would be clearly identified and affecting a default option would not been anymore mandatory ?!

              While I was writing this, you clarified what you meant, and I responded to that.

              What I was attempting to describe is related to the problem you encountered when you did a default Show search and nothing happened. The reason was because the previous Show caused text to be marked, so when you did a new default Show, it was searching within the marked text, though you meant to search the whole document. That’s what “default scope” does: it might search selected text, it might search marked text, or it might search the whole document, depending on your settings and whether text is marked, or enough text is selected, at the time.

              What bothers me is that before you click the button, it’s not obvious what the current default scope will be. Maybe you forgot you had text marked. Maybe you thought your selection was over the minimums you had set in Single selections must have at least:, but it was actually a couple characters short. You could still do what you meant to do by selecting from the drop-down menu, but you might not realize that you need to use the drop-down; then you’re left puzzled by why the results were not what you expected.

              I’ve hit this trap myself, and I wrote the damn thing!

              One possibility is that my “default scope” concept is just fundamentally flawed. Maybe the user should have to indicate, each time, whether the intent is to search the whole document, search in selected text or search in marked text. Yet I fear adding that many buttons, or using some fancy, non-standard divided buttons, would make an overly busy and confusing interface; while using modifier keys or having to use the drop-downs for everything but whole document searches would be clumsy and annoying. So I’m trying to think how I can give a visual cue as to what the “default scope” is before you click the button; that way, if it isn’t what you expected, you’ll know to use the drop-down instead (or change your selections or marks).

              The problem then becomes, if I add a scope indicator that changes with conditions, how do I do it?

              The first idea I listed was a bad one. A common indicator would be in the wrong place (that is, not where you’re looking when you go to click a button), and I was wrong about it always being the same, since the unchecked states of Allow default Select command to Select in Selection and Allow default Mark command to Mark in Marked Text exclude certain scopes from those commands only.

              The second idea makes more sense: put the indicator on each button, letting it change as conditions change. The problem is, how would I distinguish that from the scope indicators that appear if you Shift+click the drop-down menu and select a command that does not use default scope (like “Find All in Whole Document”)? You wouldn’t (easily) know when you had selected a command with fixed scope and when you had a default scope command, except by noticing whether it ever changes when you select or mark text.

              The third idea questions whether being able to set a non-default scope command as the one-click command for a button is worthwhile at all. If you can never do that, then there is no problem with confusing the meaning of the scope indicator on a button: it would always mean that is the current scope of the default scope command, since other commands could not be assigned as the one-click action for a button.

              I don’t like any of my ideas. (For that matter, I don’t like my scope and extent icons, either. The arrows are OK, but as for the rest, I tried everything I could come up with and I still think they’re obscure, confusing, ugly and hard to read.)

              So I guess I was hoping someone might come up with an idea I like better than my own. Or say something that would lead to me coming up with a better idea than the ones I’ve had so far.

              1 Reply Last reply Reply Quote 0
              • CoisesC Coises referenced this topic on
              • CoisesC Offline
                Coises @guy038
                last edited by

                @guy038 said:

                Regarding the features under consideration :

                You said :

                1. Context in search results: that is, showing one or more lines before or after the line(s) containing a match.
                • This would be optional and configurable, but a tricky question is whether it is sufficient to configure it before the search or whether you should be able to request context — either for a specific match or for all matches — directly in the search results window, after the search.

                Personally, I suppose that asking for 1 to 5 lines before / after the context, once the search ended, should be sufficient !

                Making sure we understand each other precisely is important here.

                Implementing context is not quite as simple as it sounds, but for Find All commands that create a search results list, it is much trickier if the context can be requested after the search is complete, rather than specified before the search is performed.

                I do understand that it would be handy to look at search results and then say, “Oh, I need some context. Expand this to show me two lines before and three lines after each match.” It’s a lot more complicated to implement that than to have the user specify context requirements beforehand (e.g., a setting that says, “When I search, show me two lines before and three lines after each match”) and include those lines in the search results.

                I’m not saying it’s impossible; just enough more complicated that it’s worth understanding how badly it’s wanted or needed before trying to do it.

                If I implement requesting context after the search, should it be for an individual match (“show me two lines before and three lines after this match”), for all matches, or are both options needed?

                You said

                It seems like it would make sense for this to be available for Show actions, too.

                Yes it would. I agree with your opinion !

                The next release will include something vaguely like this: the ability to “expand” visible blocks (such as those resulting from Show) by showing one additional line before and after each. This can be repeated to show more lines as desired. It doesn’t give find-grained control, but it keeps things relatively simple, and it may prove to be good enough.

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

                  Hello, @coises and All,

                  As for the two points you mentioned in your last post, I now realize that I should have given them more thought : in fact, it is, of course, much easier to agree — before conducting the search — on the number of context lines to add on either side of the lines containing the occurrence(s).

                  Thus, forget my initial proposition. I suppose that the context lines feature should be decided before the search ! Anyway, do as you like :

                  • If you think you’ll be able to manage an AFTER search context lines feature easily enough, without leading to other problems, just go ahead !

                  • If you think the BEFORE search solution would be safer and more simple, just prefer it !

                  As for the number of context lines needed, a general amount of N lines, both before and after, with 1 to 5 max should be enough !


                  Now, I’d like to add a general point :

                  Do not worry too much about what I personally think. Other users may have different opinions. After all, the Search++ plugin is your brainchild, and you should plan its structure and improvements however you see fit !

                  Personally, I prefer programs with a few well-implemented features to programs with a plethora of poorly managed features !

                  Best Regards,

                  guy038

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

                    Hello, @coises,

                    Regarding my post, I admit that the concept of a word is rather difficult to grasp. On that note, this is developed in the Martin Haspelmath’s article, published in June 2010, which highlights this point :

                    Follow this link https://zenodo.org/records/225844 to see the PDF file or use https://zenodo.org/records/225844/files/WordSegmentaionFL.pdf to download it !

                    Here are a few excerpts of his publication : :

                    At end of section 5, it is said : … On such a view, the claim that all languages have words (Radford et al. 1999: 145) would be interpretable only in the weaker sense that “all languages have a unit which falls between the minimal sign and the phrase” …

                    And : … The basic problem remains the same: The units are defined in a language-specific way and cannot be equated across languages, and there is no reason to give special status to a unit called “word”'. …

                    At beginning of section, 7 : … Linguists have “no good basis for identifying words across languages” …

                    And in the conclusion, section 10 : … I conclude, from the arguments presented in this article, that there is “no definition of word” that can be applied to any language and that would yield consistent results that are in accord with our writing habits.

                    Thus, let’s accept that our different regex engines give us an approximate count of the Words characters set !


                    Note that, on the contrary, the definition of Non-space characters is quite strict, since the Space characters set, that delimit them, consist of only 25 Unicode characters !

                    BR

                    guy038

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

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • guy038G Online
                        guy038
                        last edited by guy038

                        Hello, @coises and All,

                        Presently, I think we can summarize how your plugin works, using the table, below, on its left part :

                            •=========================•=======================•============================================•       •===============•==============================
                            |         Actions         |        Scopes         |                Extents                     |       |   Actions     |    Default configuration
                            •=========================•=======================•============================================•       •===============•==============================
                            |                         |                       |                                            |       |               |
                            |  Count                  |  In Selection         |                 N/A                        |       |  Find         |
                            |  ¯¯¯¯¯                  |                       |                                            |       |               |
                            |                         •-----------------------•--------------------------------------------•       •---------------•------------------------------
                            |                         |                       |                                            |       |               |
                            |  Find All               |                       |  Before Caret                              |       |  Count        |
                            |  ¯¯¯¯¯¯¯¯               |                       |                                            |       |               |
                            |                         |  In Marked Test       |  After Caret                               |       •---------------•------------------------------
                            |                         |                       |                                            |       |               |
                            |  Mark                   |                       |  Everywhere                                |       |  Find All     |
                            |                         |                       |                                            |       |               |
                            |                         |  In Whole Document    |  In All Opened Documents                   |       •---------------•------------------------------
                            |                         |                       |                                            |       |               |
                            |  Replace All            |                       |  In All Opened Documents of Current View   |       |  Select       |
                            |  ¯¯¯¯¯¯¯¯¯¯¯            |                       |                                            |       |               |
                            •-------------------------•-----------------------•--------------------------------------------•       •---------------•------------------------------
                            |                         |                       |                                            |       |               |
                            |                         |  In Selection         |                 N/A                        |       |  Mark         |
                            |                         |                       |                                            |       |               |
                            |  Select                 •-----------------------•--------------------------------------------•       •---------------•------------------------------
                            |                         |                       |                                            |       |               |
                            |                         |  In Marked Text       |  Before Caret                              |       |  Show         |
                            |                         |                       |                                            |       |               |
                            |                         |                       |  After Caret                               |       •---------------•------------------------------
                            |  Show                   |                       |                                            |       |               |
                            |                         |  In Whole Document    |  Everywhere                                |       |  Replace      |
                            |                         |                       |                                            |       |               |
                            •-------------------------•-----------------------•--------------------------------------------•       •---------------•------------------------------
                            |                         |                       |                                            |       |               |
                            |  Find                   |  In Selection         |                                            |       |  Replace All  |
                            |  ¯¯¯¯                   |                       |  Backward  ( if Plain text )               |       |               |
                            |                         |  In Marked Text       |                                            |       •===============•==============================
                            |                         |                       |                                            |
                            |  Replace                |  In Whole Document    |  Forward                                   |
                            |  ¯¯¯¯¯¯¯                |                       |                                            |
                            •=========================•=======================•============================================•
                        

                        The underlined actions are those which have a button, by default

                        Personally, your concept of a default scope bothers me a little, because it’s hard for me to know, in advance, which actions will be automatically selected by the plugin !


                        So, I was thinking about a radically different layout :

                        • You entirely suppress the default scope functionality. However, I suppose this will affect the Selection section in the settings !

                        • You does not show any symbol on all the buttons, nor use any drop-down list

                        • You just show six one-letter buttons and two one-letter button for the replace actions, as below :

                            |F|  |C|  |A|  |S|  |M|  |H|    :    Find    Count    find All    Select    Mark    sHow
                        
                            |R|  |A|                             Replace    replace All
                        
                        • All these simple-design buttons would open a common dialog box, in which the selected action — one of the eight possible options — would be already selected by default. This dialogue could be based on the table shown above !

                        • Then, you’ll just have to check your present scope and extent choices for the chosen action

                        • Optionally a message, summarizing everything that has just been selected, could be displayed

                        • Then, this new dialog would end with three buttons :

                          • A Define button to attribute a default configuration ( scope and extent ) for the chosen action, without any execution.

                          • A Run button to start the chosen action, without any default configuration to apply to

                          • And, of course, a Cancel button, or an hit on the ESC key, to dismiss the chosen action

                        IMPORTANT :

                        As we must distinguish a default configuration ( the set of the 3 elements : action, scope and extent ) from the execution of a simple action with ramdom scope and extent, the Define button, introduced above, must record that default configuration, within this dialog.

                        So, when clicking on the Define button, the default configuration, to write in this new dialog, would be :

                        For the Count, Find All, Mark and Replace All actions, one of these 11 messages

                        Count / Find All / Mark / Replace All in Selection
                        Count / Find All / Mark / Replace All in Marked text
                        Count / Find All / Mark / Replace All Before in Marked text
                        Count / Find All / Mark / Replace All After in Marked text
                        Count / Find All / Mark / Replace All in Marked Text in Open Documents
                        Count / Find All / Mark / Replace All in Marked Text in Documents in this View
                        Count / Find All / Mark / Replace All in Whole Document
                        Count / Find All / Mark / Replace All Before in Whole Document
                        Count / Find All / Mark / Replace All After in Whole Document
                        Count / Find All / Mark / Replace All in Open Documents
                        Count / Find All / Mark / Replace All in Documents in this View
                        

                        For the Select and Show actions, one of these 7 messages :

                        Select / Show  in Selection
                        Select / Show  in Marked text
                        Select / Show  Before in Marked text
                        Select / Show  After in Marked text
                        Select / Show  in Whole Document
                        Select / Show  Before in Whole Document
                        Select / Show  After in Whole Document
                        

                        For the Find and Replace actions, one of these 6 messages :

                        Find / Replace Forward in Selection
                        Find / Replace Forward in Marked Text
                        Find / Replace Forward in Whole Document
                        Find / Replace Backward in Selection
                        Find / Replace Backward in Marked Text
                        Find / Replace Backward in Whole Document
                        

                        Notes :

                        • Of course, you could, in one go, click first on the Define button, then click on the Run button

                        • A simple click on any of these eight buttons, would allow to quickly verify their default configurations, as long as you press the Cancel button, right after !


                        In other words, no more drop-down menus ! Instead, a new configuration dialog to confirm the default scope and extent values of the chosen action AND / OR the execution of the chosen action, with the present options checked in the scope and extent sections

                        There are surely some drawbacks to my proposal ! Anyway, what’s your feeling about this radical change ?

                        Best Regards,

                        guy038

                        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