Navigation

    Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly

    General Discussion
    feature request
    7
    14
    231
    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.
    • Alan Kilborn
      Alan Kilborn last edited by

      The OP’s suggestion here in this thread (using a “Library” tab) seems a bit, well, bad for a UI. Especially one that is rather space-limited, like Notepad++'s. I don’t really like the Title/Explanation duality – couldn’t this be combined into one thing?

      I think I like the suggestion HERE for EditPlus the best; the UI from there shown below for convenience of reference:

      b3adbd14-f875-4fc8-b0ad-d7c4a295d65d-image.png

      It might be best to take that (the EditPlus example) a bit further and show a populated top list box. I don’t know EditPlus, but I would expect that double-clicking an entry in that top list box would cause the “Find & Replace List” window to close and the double-clicked entry’s parameters to be copied back into the original dialog that had the “List…” button?

      There are some additional hurdles for this when thinking about Notepad++ (presuming a “List…” button appears on every tab of the Find dialog tab control), but it wouldn’t be too bad…

      I think this might be a good start for a needed Notepad++ feature.

      (Of course, I don’t know UltraEdit either, and in the github issue the UltraEdit example wasn’t really shown, but maybe it has some design tidbits to offer as well).

      Alan Kilborn PeterJones 2 Replies Last reply Reply Quote 3
      • Alan Kilborn
        Alan Kilborn @Alan Kilborn last edited by

        @alan-kilborn said in [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly:

        …I would expect that double-clicking an entry in that top list box would cause the “Find & Replace List” window to close and the double-clicked entry’s parameters to be copied back into the original dialog that had the “List…” button?

        Of course, clicking OK after making a selection would do the same thing (forgot to say this originally).

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

          More thoughts:

          • Change EditPlus’s OK button to “Use” (this would also save any unsaved changes to the current entry before “using” it)
          • Change EditPlus’s Remove button to “Delete” (delete being a more-common Notepad++ usage) (this was actually OP’s idea); deletion would need to be confirmed
          • Change EditPlus’s Up and Down buttons to be more explicit as “Move Up” and “Move Down” to move the currently selected entry up or down
          • Add a “Duplicate” button to make a copy of the current entry (if there are unsaved changes to the current entry, save them before doing the duplication)
          • Add an “Update” button if the user starts making changes to the current entry’s data (this was actually OP’s idea) but doesn’t want to close the box and “use” the current entry, just wants to save it
          • To abort errant changes to the current entry, “Cancel” button would be used (have to re-press the “List…” button to come back in and do more editing)
          • When the “List…” button is pressed, if the current find/replace data is not in the list, offer to add it? If it is in the list, make it the current entry for quick-access mods?
          1 Reply Last reply Reply Quote 2
          • PeterJones
            PeterJones @Alan Kilborn last edited by PeterJones

            @alan-kilborn ,

            I’ll weigh in with my ℕ¢:

            • Having a Library… button that pops up a second window next to the Find window makes more sense to me than having a separate Library tab: I would think anyone who wanted a library of frequent expressions would want to be able to use them for Find, Replace, Find in Files/Projects or Mark, and that just wouldn’t work well with a Library tab, because you’d keep having to tab between the Library tab and the actual Find or Replace tab as you wanted to access the library.
            • I prefer the name Library… for that button instead of List…
            • I think Use makes more sense than OK for copying the selected expression to the Find/Replace window
            • I do not think that Use should close the Library window… I would want to keep that second dialog open while doing multiple searches or replacements (similar to the way that the Find window stays open to allow for Find Next or modifying the regex without closing the window)
            • I agree there should be an Update button – or maybe Modify, with no strong opinion as to which. (I originally thought I liked Modify more, but Update is growing on me)
            • I think the “exit the Library” button should be Close rather than Cancel: my reasoning would be that a user might think that Cancel would undo everything done in the Library window – so it would undo adds, deletes, moves, or uses. But I don’t think it’s practical to keep a history of all those events to be able to fully undo everything. One would have to hit Close before doing a Use if one doesn’t want to change the FIND/REPLACE expressions in the Find window; one would have to do a Close before doing an Update if one didn’t want to change the values in that entry in the library. But once Use or Modify or Add or Delete is clicked, I do not think it should be undoable, and Cancel would imply that to at least a large subset of users.
            • Definitely offer to add the existing FIND/REPLACE pair to the library when Library… is first opened… but rather than an extra popup for the “offer”, I would just say pre-populate the input fields in the library and make sure that Add is enabled with nothing in the main panel selected. Something like:
              fa2cad69-d5bf-462c-b927-72ac035cbe87-image.png
            Michael Vincent 1 Reply Last reply Reply Quote 5
            • Michael Vincent
              Michael Vincent @PeterJones last edited by

              @peterjones said in [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly:

              @alan-kilborn ,
              I’ll weigh in with my ℕ¢:

              All great points! I think the separate GUI is key since the Find / Replace dialogue and each tab is already very busy - a button to open the new “Library” form consistent on each tab would do the trick along with all the recommendations you all make about the visual elements of that new GUI.

              Cheers.

              1 Reply Last reply Reply Quote 4
              • guy038
                guy038 last edited by guy038

                Hello, @michael-vincent, @peterjones, @alan-kilborn and All,

                Peter, I agree to that @michael-vincent said :

                All great points! I think the separate GUI is key


                Now, Michael, you said :

                a button to open the new “Library” form consistent on each tab would do the trick…

                Huuum, I would say that opening this new window with the Library button should recapitulate all the parameters, regarding the Find/Replace/Mark feature. Indeed, for instance :

                • You may decide to extend a search, initially done on all opened documents, to some directories, and, possibly, update the library, accordingly

                • You may decide to extend a simple search, already saved, to a search and replace action and add this new S/R to the library

                In the opposite way :

                • You may decide to modify an initial search and replace saved operation to a simple Mark operation, and so on…

                Some specific points :

                • What’s about the Extended (\n, \r, \t, \0, \x..) search mode ? From your pictures, if the Regular exprresion is not ticked, this choice forces the Normal search mode, automatically. Note that I personally never use the Extended mode but some people may be used to select it !

                • If we suppose that each item of the library will save the states of the case and whole word boxes, what’s about the other options :

                  • Backward direction

                  • Wrap around

                  • . matches newline

                  • Filters and directories fields :

                  • Bookmark line

                  • Purge for each search

                To my mind, their states should be saved, too as it determines the way the global action is performed !


                Now, I’m thinking about a small improvement. Let’s imagine, in the main panel of the new Find and Replace Library, something like that :

                # My SPECIFIC changes in the 'Results.txt' file, exported from the 'Everything' software :
                
                    - Change the HEADER line
                    - Modify the column's ORDER and the SEPARATORS 
                    - Justify the SIZE numbers to the RIGHT
                

                Corresponding, in my case, to the following `S/R`` :

                SEARCH    "Nom","Chemin","Taille","Extension","Date de modification","Type","Date de création","Horodatage dernier accès","Attributs","Date d'exécution"
                
                REPLACE   "Nom","Chemin",123456789,"Extension",2021-12-31 23:59:59,"Type",2021-12-31 23:59:59,2021-12-31 23:59:59,"Attributs",2021-12-31 23:59:59
                
                
                SEARCH    (?-s)^"(.+?)","(.+?)",(\d+),".+?",(.+?),.+
                
                REPLACE   \1\t\3\t\4\t\2
                
                
                SEARCH    \x20{5}\K(\d+)(\x20+)(?=\x20{5}\d{4}-\d\d-\d\d)
                
                REPLACE   \2\1
                

                Of course , I do not mean at all that these 3 S/R should be executed in one go !

                I just mean, that, from my comment header, beginning with a # char, the indented items show a group of several independent S/R, which must be sequentially executed against the same Results.txt file, to get the needed modifications !

                Best Regards,

                guy038

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

                  @guy038

                  opening this new window with the Library button should recapitulate all the parameters, regarding the Find/Replace/Mark feature

                  I think the intent here is not really to reinvent currently macro-recordable complete actions (Find/Replace/Find in Files/Mark) but rather just to capture the “searchable” part. Thus, something that is part of the “Library” can be used independently of the specific search function. Now, clearly a bit of replace text is only good for a replace (or replace-in-files) action, and so remains unspecified for other types of actions, but things like directory/bookmark/filters/search-direction/etc. (things that don’t impact the direct text search) are not important. I’m not sure how to best say it, but perhaps you get my meaning. If this feature gets over-complicated in its specification, it won’t possibly get implemented.

                  What’s about the Extended (\n, \r, \t, \0, \x…) search mode ?

                  Surely an oversight in previous discussions; it should be included. And maybe also worth saying is that “whole word” should be disabled when “regular expression” is selected on an entry.

                  I’m thinking about a small improvement…

                  This could be handled by no additional logic/code, but rather by a common prefix on the "Description"s of several sequential entries (can be made sequential with the “Move Up”/“Move Down” buttons if needed).

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

                    Hi, @michael-vincent, @peterjones, @alan-kilborn and All,

                    So Alan, if I follow your reasoning, it means that, rather than having the 3 zones Case sensitive, Whole word only and Regular expression, at the bottom of the window, we should better put the 3 modes of search Normal, Extended and RegExp

                    Then, it would be up to each user to verify the state of the different checkboxes and fields, before starting the whole process. Indeed, they could be considered as flavours of the chosen search mode !

                    BR

                    guy038

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

                      @guy038 said in [Suggestion] Add The library tab in the Find and Replace window to reuse Regexes mainly:

                      it means that, rather than having the 3 zones Case sensitive, Whole word only and Regular expression, at the bottom of the window, we should better put the 3 modes of search Normal, Extended and RegExp

                      Well…I think the following all belong:

                      • case sensitive checkbox
                      • whole word checkbox
                      • search mode dropdown with the obvious 3 choices: Normal, Extended, Regular expression – or maybe 4 choices: Normal, Extended, Regular expression where . matches newline, Regular expression where . doesn’t match newline.

                      Surely you see that e.g. “case sensitive” is more bound into the search trying to be captured here than something like e.g. “Backward direction”.

                      BTW, and I probably should have stated this earlier, a design goal with crafting a specification for this is that we don’t go this far with it: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9627 :-)

                      Lycan Thrope 1 Reply Last reply Reply Quote 2
                      • guy038
                        guy038 last edited by guy038

                        Hi, @alan-kilborn and All,

                        Yes, your proposition seems sensible ! In this new Find and Replace Library window, we should stay concerned about options relative to the WAY of searching and/or replacing.

                        And all the other parameters :

                        • Regarding the direction of the search ( Backward direction, Wrap around options )

                        • Regarding the scope of the search ( Filters: and Directory: fields )

                        • Regarding the tracking of the search ( Bookmark line and Purge for each search options )

                        would be defined by the user, before running the process


                        Thus, this leads to have, at the bottom of that window, two rows of options :

                        • Case sensitive, Whole word and Normal

                        • Extended, RegExp and RegExp (Dot=All)

                        Just a suggestion, of course !

                        Best Regards,

                        guy038

                        Robin Cruise 1 Reply Last reply Reply Quote 4
                        • Robin Cruise
                          Robin Cruise @guy038 last edited by

                          @Taije Park a new feature is a new beginning. I really like your idea.

                          1 Reply Last reply Reply Quote 0
                          • Lycan Thrope
                            Lycan Thrope @Alan Kilborn last edited by Lycan Thrope

                            @alan-kilborn ,
                            After looking at that, I agree, that is a micro management screen. :)
                            All people really want is something to store their regularly used search expressions in a handy library space with the search and replace menu so it pastes it in and runs it. Anything more than that can overwhelm users, especially novices…which seems to be the dominant species to using the free Notepad++ editor.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Copyright © 2014 NodeBB Forums | Contributors