Community
    • Login

    Search++: A work in progress

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    149 Posts 9 Posters 46.8k 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 Coises

      @guy038 said:

      Sorry, @coises, but I came acroos some differences of counting, in regex mode, between your two plugins Columns++ and Search++

      It will take me some time to test, but my guess is that the differences come from this:

      • Search++ uses the properties returned by the ICU 78.3 (Unicode 17) API directly.

      • Columns++ uses a Python script to condense information from the Unicode Character Database tables into static C++ structures which can be searched quickly at run time. Subsequent tests (I think it was you who first ran them) showed that my method does not capture all relevant Unicode properties for all characters correctly.

      • Notepad++ and MultiReplace use whatever Boost.regex does by default when matching UTF-16 or a legacy codepage. I think this relies entirely on Windows character classification routines.

      I expect that the results in Search++ using Regex and ICU will be identical. Any discrepancies would probably indicate bugs in the Regex implementation; the possibility of running tests like that is why I included ICU in the first place.

      Edit to add:

      If you simply count word characters (\w) in your Total_Chars.txt file, you’ll see that Notepad++, Columns++ and Search++ (Regex or ICU) come up with different counts:

      Notepad++ native: 48,031
      Columns++: 146,443
      Search++: 149,366

      Regex in Search++ uses the definition in Unicode Technical Standard #18: Unicode Regular Expressions. ICU in Search++ uses the ICU4C implementation of regular expressions directly.

      Columns++ defines a word character as General Categories Ll, Lm, Lo, Lt, Lu and Nd plus the underscore. Relative to the Unicode standard, it misses connector punctuation (except the underscore), digits that are not decimal digits, marks, characters that are classed as alphabetic but are not letters, and the join control characters.

      Notepad++ native search and MultiReplace use Boost.Regex without customization for character traits, which relies on GetStringTypeExW. I think a word character is defined as one which returns the flag for C1_ALPHA or C1_DIGIT or is an underscore.

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

        Hello, @coises and All,

        So here are my thoughts on the various points you raised in this post. Of course, these opinions are my own and do not reflect the views of anyone else !


        Regarding the obvious missing features :

        You said :

        1. Implement Replace in Files in the Search in Files dialocg.

        I’m very interested in this feature because the search function is already very flexible: searching by size or date, or selecting files using regex => Thus; this would allow for highly customized replacements !

        You said :

        1. Ability to save and recall search strings.

        I’d lean toward a configurable number of items, between 1 to 30 maximum, in the history, which, in my opinion, would not be used very often, if the saving S/R feature is implemented !

        You said :

        • Would the ability to “pin” history items be useful? (Simpler and faster than a save process.)

        Personally, I think that saving S/R is preferable !

        You said :

        • For saving I’m thinking of controlling that through a dialog that would let you name what you save, so you would then recall it by name. Saving would save the Find and Replace strings and the associated settings. It would have to be possible to edit, rename or delete a saved search as well. Recalling would probably be by selecting from a flyout on the right-click menu. Thoughts? Is that too complicated?

        I’m globally very much in favor of this system !

        You said :

        • Should the regular dialog (for searching in documents) and the Search in Files dialog share a single set of saved searches?

        The type of search and replace performed on a set of files is generally different from that performed on a single file or on a few files opened in an Notepad++ session => Therefore, if possible, the use of two separate lists would be nice, but don’t bother too much about it !


        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 !

        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 !

        You said :

        2 Warn or block when characters used in the find or replace fields are inconsistent with the character encoding of files to be searched. (Right now find proceeds without a warning, and replace uses the substitution character, usually a question mark.)

        I would say : displays a warning and tell that any non encodable character will be replaced with an interrogation mark !

        You said :

        • Find is tricky, because I would have to parse the regular expression to attempt to determine whether the inconsistent characters are required for a match (so no match is possible) or whether they are only required by some alternatives (which might be intentional, if the same expression is used with files in different encodings). Is it worth doing at all? Would a warning (so I didn’t have to parse, since you could just say to search anyway) be more annoying than helpful?

        The more simple , the best ! Don’t analyze files first : just put a warning, before the search, that any non encodable character will be changed into an ? symbol, within the Search++ results panel !

        You said :

        • Replacing can also be conditional, so do I try to detect that, and if it’s conditional, only warn or block if it actually happens? If replacing in multiple files, it could vastly slow down the process if I have to examine each file first to determine its encoding before beginning the actual replace operation. Is it worth it? Or do I only raise the warning if and when I encounter a file that can’t do the replace as written?

        As above, just a warning, before the replacement, that any non-encodable character will be replaced with a ? symbol !

        You said :

        3 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)?

        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 , on the right of the Search++ panel — which would clearly indicate whether we’ve selected : a list, a selection, a mark, or just the results of a search !

        You said :

        1. 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.

        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 !

        You said :

        5 Figure out how to modify Boost.regex to support Unicode word boundaries, and extend that to plain text searches by translating them into regex searches. (Unicode word boundaries recognize that sequences like “can’t” are a single word; for example, if implemented, a whole word match for “can” wouldn’t match the first three letters of ”can’t”; at present, it does.)

        This point does not seem essential either, at least at first !

        You said :

        6 Implement “Unicode compatibility forms” matching. This means being able to search for something like “naive” and have it match “naïve” (or vice versa). I think I would only attempt to implement this, at least at first, for plain text searches (which would be translated to a regular expression the user would not see).

        This option seems interesting, and I’m definitely in favor of it!


        Regarding the Deficiencies and bugs :

        You said :

        1 Personally, I really like the Show function. It hides all lines and then shows the ones that have matches, also marking the matches. A bit like a Find All with the results list right in the document instead of in a tiny little window at the bottom. But there are problems. I use Scintilla’s hidden lines feature directly. Notepad++ also uses that feature, but it doesn’t provide a way for plugins to use it through Notepad++, and it keeps internal status information that assumes only it is using hidden lines. There appears to be no way to make Notepad++ synchronize its own idea of which lines it thinks are hidden with the actual state of Scintilla. Various bizarre things happen because of this. That leaves me with four choices, none of which are great:

        • Remove the Show function entirely.
        • Accept that if you use Show, unintended and illogical things can and will happen.
        • Petition Don to provide a way for plugins to use hidden lines without confusing Notepad++, which might not be accepted, would probably take a long time even if it is accepted, and even when completed would mean this would only work correctly on versions of Notepad++ at least that new.
        • Get “creative” and look for some back-door, hacky way to fix it (which might or might not be possible, and might break without warning when Notepad++ changesc something).

        I would keep option 2 ( Accept the SHOW feature as is ) and, eventually, ask @DonHo about the hidden lines !

        You said :

        2 Keyboard navigation in the Search++ dialog (the main one that can be docked, not the Search in Files dialog) is clunky and not comprehensive.

        • There’s no straightforward way to invoke something like “Select in Marked Text” without using the mouse.
        • There’s a setting to focus the document after stepwise Find and Replace, but if you check that then there’s no way to do the next Find or Replace without switching back to the Search++ dialog first. The only way I can think of to manage that would be to add two more menu items, which you could assign to free keyboard shortcuts… as if anyone has any free yet memorable keyboard shortcuts. Doing repeated Find actions while being able to edit immediately in the document after a Find seems like a common task. It should be natural and fluid, but it isn’t.

        I didn’t quite understand this specific point. Personally, I do not see any major difference between whether or not to enable the Focus the document after option named : stepwise Find and Replace commands ? Could you clarify this for me ?

        You said :

        3 For Search in Files actions, there is presently no warning about files that are open in Notepad++; the files are processed on disk. This will be more critical when Replace in Files is implemented.

        • My thought is to present a warning, with OK and Cancel options, noting that Search in Files only processes files on disk. Note that for Find in Files, the impact is that files that were open with changes would search based on the data on disk, not the live version of the document. Documents that are open in Notepad++ (with or without changes) and are also changed on disk by Replace in Files would show a “File changed” notification when activated in Notepad++.
        • Because of the way Search in Files works, it would be complicated to treat files open in Notepad++ differently, but is that something that is really important… important enough to go ahead and make the code more complicated in order to do it, so that files open in Notepad++ are processed as open documents and not as files on disk?

        As I mentioned in a previous post, because of your multithreaded approach, you need to scan the files stored on disks. This is not a problem for me, as long as it’s indicated by a warning that could be dismissed until the next time Notepad++ is opened.

        You said :

        4 The date selection controls in the Search in Files dialog look awful in dark mode. Unfortunately, it turns out the Windows control I used is just about impossible to render in dark mode. (At least, I haven’t found a single example in open source of someone doing it successfully.) So I expect to replace it with something simpler, more like a text control with a drop-down history, where you just type the date.

        • Would it be useful to be able to enter the time, and not just the date, to limit which files are examined?

        I do not think it’s necessary to include the time, since a specific date has already been selected : the search would then be limited to files from a given day, which doesn’t seem like an insurmountable challenge !

        You finally said :

        • Would a single universal format (yyyy-mm-dd) be good, or is it an important user amenity to be able to enter dates in your locale format (e.g., mm-dd-yy in the US, dd-mm-yy in most other places)?
        • Would you miss the drop-down calendar control? Would you miss having up/down arrows (spin control) for the elements of the date and thus needing to type the numbers to change the date?
        • Does anybody even think the date filter is useful in the first place? Do I need a way to take a date from a specific file, rather than the user knowing what dates are wanted, to make it useful?

        Technically speaking, using the universal format (**`yyyy-mm-dd**), in text mode, would certainly be easier to implement and would also ensure correct display in both modes ( light and dark ) ! Of course, a reminder of the syntax to use would be necessary !

        Best Regards,

        guy038

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

          @guy038 said:

          (I’ll answer various parts of your post in separate comments.)

          The more simple , the best ! Don’t analyze files first : just put a warning, before the search, that any non encodable character will be changed into an ? symbol, within the Search++ results panel !

          As above, just a warning, before the replacement, that any non-encodable character will be replaced with a ? symbol !

          First, I must apologize: my original observation, to which you responded, was not as well thought out, nor as clear, as it should have been. The problem differs significantly depending on whether the search is against the current document, multiple open documents, or files on disk. This response is ridiculously long, largely because I’m “thinking out loud” what I should have thought to myself before posting the item about characters inconsistent with file encodings in the first place.

          Don’t analyze files first

          The thing is, I don’t know what characters cannot be encoded until I know the encoding of the document or file.

          For searching an open document, it’s possible to get the encoding from Notepad++ using NPPM_GETBUFFERENCODING, but there is a problem: as best I can tell, that message doesn’t tell you when an entry from the Encoding | Character Sets menu is in effect (either because the user selected it, or because Settings | Preferences… | MISC. | Autodetect character encoding is enabled). The buffer will be in UTF-8, which means all Unicode characters would appear to be valid, but anything not in the selected character set would be lost when the file was saved.

          (Somewhat mitigating this is that Notepad++ itself allows characters that can’t be encoded to be entered or pasted when a character set is selected. You can demonstrate this by opening a new document, selecting Western European | Windows-1252, pasting Abcdefgαβγδxyz. into it, then saving and reopening. The alpha and delta are changed to a and d, the beta is changed to a German sharp s, and the gamma is replaced by a question mark. Yet no sign of this appears when you paste or when you save.)

          For files on disk, there is no way to determine the encoding without reading the file. Reading every file first to determine the encoding before doing a find or replace could double the time it took to do the operation; yet with Replace, doing some but not all replacements in a folder could leave the user with a very confusing situation.

          The more I think about it, I believe the only way to deal with this — and other things that can go wrong — will be to have Replace in Files by default create new files, effectively keeping the original files as backups that can be restored if the user wants to “undo” the entire operation. The downside is that doing so will take more space on the target device and “pollute” the device, at least temporarily, with unwanted files; for large files with only a few small changes on random access devices, it could make the process much slower as well. So it would have to be an option.

          At present, I have nothing equivalent to character sets or Autodetect character encoding in Search in Files; anything that doesn’t have a byte order mark and isn’t valid UTF-8 is assumed to use the system default code page (aka “ANSI”). That could cause trouble if people have mixed legacy encodings in files they try to search, since unlike when loading a document in Notepad++, there would be no visual indication that anything is wrong. At the very least, there is the problem of whether pure ASCII files should be assumed to be ANSI or UTF-8 if a replacement uses a non-ASCII character that is in the system default code page.

          just put a warning, before the search, that any non encodable character will be changed into an ? symbol, within the Search++ results panel !

          The results list is no problem; it’s always in UTF-8. For the find string, the reason for showing a warning would be to tell the user the requested search can never succeed. For single document searches, it could be helpful to show an error bubble if the find string can never match because it includes characters that cannot be represented in the current document encoding (like searching for a Greek letter gamma in an ANSI document when the system code page is Windows-1252). 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.

          The difficult part of this is that for regular expression searches, it’s not simple (algorithmically) to tell which characters must match for the whole expression to match, and which are only required by some alternatives. It might not even be possible in the general case; I would have to investigate that.

          But I don’t think it’s all that important for the find string, and it could be limited to warning about Plain text searches that can never succeed, if it is worth doing at all.

          For replacing, though, it bothers me more, particularly the problem that in Replace in Files it will be dreadfully inefficient to attempt to determine the encoding of all files before starting any replacements — which suggests that notifying the user when a problem actually happens, not trying to predict it ahead of time, would be the way to go — yet, being left with a folder where some files have been processed and some could not be processed could easily be problematic.

          In the end, I should not have raised this point at this time. It doesn’t have much impact in the find case (just identifying why a search has no results), while the worst case, Replace in Files, can’t really be evaluated until I actually design and implement Replace in Files. I apologize, again, for the diversion.

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

            @guy038 said:

            You said :

            1. Keyboard navigation in the Search++ dialog (the main one that can be docked, not the Search in Files dialog) is clunky and not comprehensive.
            • There’s a setting to focus the document after stepwise Find and Replace, but if you check that then there’s no way to do the next Find or Replace without switching back to the Search++ dialog first. The only way I can think of to manage that would be to add two more menu items, which you could assign to free keyboard shortcuts… as if anyone has any free yet memorable keyboard shortcuts. Doing repeated Find actions while being able to edit immediately in the document after a Find seems like a common task. It should be natural and fluid, but it isn’t.

            I didn’t quite understand this specific point. Personally, I do not see any major difference between whether or not to enable the Focus the document after option named : stepwise Find and Replace commands ? Could you clarify this for me ?

            The difference with that option is whether Find or Replace (but not Find All or Replace All) leave keyboard focus in the Search++ dialog or put it in the document.

            Putting focus in the document means you can start typing, deleting or navigating, if you choose, immediately upon finding or replacing. You don’t need to click in the document or type Ctrl+N first. However, it also means that if you want to Find or Replace again, you have to use the mouse to click the button or use whatever key combination you’ve assigned to Plugins | Search++ | Search… to return focus to the dialog. You can’t just press Alt+F and/or Alt+R repeatedly, because those only apply when the Search++ dialog has focus.

            What I’m saying I think is missing is something similar to F3 for Notepad++ search: the ability to leave focus in the document, instead of bouncing back and forth between the document and the dialog, and still do repeated finds (and, as I intend it, also replacements) with a keyboard combination. If you use the floating dialog rather than the docking one, being able to close the dialog and still continue searching/replacing step by step is valuable.

            The earlier point was just about the general lack of key combinations for functions on the drop-down menus. Windows has the split button (button with a drop-down) as a native UI element, but while you can access the drop-down with the down arrow on the keyboard once focus is already on the button, the only way to move focus to the button without activating its main function is with the tab key; you can’t use an Alt+ combination, because that does the action on the key (and does not move the focus). So if focus were in the Find box and you wanted to perform a “Show” using only the keyboard, you would have to type Alt+M twice (moving focus to the Match case box and toggling it, then toggling it back), then Shift+Tab (tabbing backward to the Find All button without activating it), then pressing the down arrow key to open the menu and H to select Show.

            That’s way too hard to do a simple thing. I tend to be sensitive to keyboard stuff because, a long time ago, I was on a beta team for some software, and also on the team was someone who was disabled in such a way that he could not use a mouse. It made me very aware that there should always be a straightforward way to do anything by keyboard only.

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

              @guy038 said:

              I would keep option 2 ( Accept the SHOW feature as is ) and, eventually, ask @DonHo about the hidden lines !

              Yes, I think so, too. After your observation of navigation failing to work as expected after Show All, I realized much of what I thought was a problem with hidden lines may have been due entirely to my faulty implementation of Show All (which I’ve already fixed for the next release).

              That leaves the main weakness being that the hidden lines status is lost when changing tabs; when you change back, Notepad++ restores what it thinks was the hidden lines status.

              I think I have a solution to the other problem you observed with Show (that doing a second default Show typically doesn’t work, because it performs Show in Marked Text when you probably don’t want that). Show should use a different style (indicator) than the one used for marked text. I have most of the code needed for that working already, so a version of that will be in the next release.

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

                Hi, @coises and All,

                @coises, 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


                Regarding the general problem about focusing within the plugin dialog or within the current document, I don’t bother about it. Given that I attributed the Ctrl + Shift+ N shortcut to Search++ > Search... command :

                • If I decide to focus on active document ( by enabling the the stepwise Find and Replace option in Settings ), I just have to do a Ctrl + Shift + N shortcut in order to focus the Search++ dialog, again

                • If I decide to focus the Search++ dialog ( by disabling the stepwise Find and Replace option in Settings), I see three advantages :

                  • Firstly, we do not modify the current document by mistake, as focus is on plugin

                  • Secondly, we can use the Alt + F and Alt + R shortcuts to realize a stepwise Search / Replacement

                  • At any time, we can switch to current document, by using a Ctrl + N shortcut, for possible modifications. And then, go back to the plugin with the Ctrl + Shift + N shortcut


                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 !


                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 ?!


                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 !!

                Best Regards,

                guy038

                CoisesC 2 Replies Last reply Reply Quote 0
                • 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

                          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