Community
    • Login

    Search++: A work in progress

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    197 Posts 11 Posters 59.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:

      This time, I would avoid any option that excludes the EOLs and I propose this new sub-menu :

      A Invert only the marked text
      
      B Invert only the bookmarks
      
      D Invert bookmarks, then mark all text and EOL of the bookmarked lines
      
      C Invert marked text, then bookmark all lines containing marked text
      
      • Note that running, consecutively, the A and B actions is equivalent to the D action

      No, it isn’t. If you search for something using the Mark command, only the text that actually matches is marked. Invert marked text marks everything that wasn’t marked and unmarks everything that was marked, so it marks the text surrounding the matches but leaves gaps where the matches were. Potentially useful if you want to search only text that the last search didn’t match.

      If you had Bookmark lines when marking text checked when you did that Mark command, there will have been a bookmark on every line that contained any marked text. If you then Invert bookmarks, the bookmarks will be only on lines that had no marked text at all.

      Put the two together and you’ll have marked text with gaps where the original matches were, and bookmarks only on lines that have no gaps.

      Invert bookmarks and mark only bookmarked lines would bookmark the same lines as the above process, but every bookmarked line (that is, every line that originally contained no part of any match) would have all its text marked. The details of which parts of lines matched and which didn’t would be completely lost.

      An additional complication is zero-length matches. It is impossible to mark a zero-length match; but when marking with Bookmark lines when marking text checked, the lines containing zero-length matches are still bookmarked.

      When you invert bookmarks, a line containing one or more zero-length matches will then not be bookmarked. If you invert bookmarks first and then mark the bookmarked lines, that line won’t be bookmarked or marked. If you invert the marks and the bookmarks separately, the line will be fully marked (because it had no marked text), but not bookmarked.

      You might have meant to say that A followed by B is equivalent to C, rather than D. However, in the zero-length match case, option C would bookmark the line that previously contained only zero-length matches (since it would now be fully marked).

      I’m still not sure what will be useful and what won’t be; I just wanted to note that it does make a difference whether you invert marks and bookmarks separately or whether you invert one and then derive the other by synchronizing.

      And of course, if you have marked text that wasn’t marked with bookmarking on, or if you added or removed bookmarks by hand, that would also lead to different results for the various operations.

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

        @guy038 said:

        Now, regarding the present Invert marks or bookmarks sub menu, below :

        A Invert marked text
          Invert marked text, excluding unmarked line endings
        
        C Invert marked text and sync bookmarks
          Invert marked text, excluding unmarked line endings, and sync bookmarks
        
        B Invert bookmarks
        D Invert bookmarks and mark only bookmarked lines
          Invert bookmarks and mark only bookmarked lines, excluding line endings
        

        This time, I would avoid any option that excludes the EOLs and I propose this new sub-menu :

        A Invert only the marked text
        
        B Invert only the bookmarks
        
        D Invert bookmarks, then mark all text and EOL of the bookmarked lines
        
        C Invert marked text, then bookmark all lines containing marked text
        

        Since Notepad++ already has an Inverse Bookmarks command, what would you think of going back to a single Invert marked text command (no sub-menu) and just leaving it to users to use the Notepad++ command and/or follow up with a command from the Synchronize marks and bookmarks menu if they want one of the other results?

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

          @guy038 said:

          I would avoid any option that excludes the EOLs

          Let me try to give an example of what I think is the problematic behavior. I agree that making users worry about whether or not to include line endings is not good.

          Copy this into a new tab:

          Consider this:
          I see them all.
          You know I see them all.
          Do you understand?
          

          Turn on display of line endings.
          Make sure there are only four lines: if copying added a trailing CRLF, remove that.

          Now, Mark using Regex with the following find text:
          I see.*$
          and Dot matches line breaks not checked.

          db38d386-9f2c-4bac-a6c7-ffb9be59cf53-image.jpeg

          Now, observe what happens with each of these three seemingly reasonable sequences (after each, remove marks and bookmarks, and start fresh with a new Mark command):

          Invert Marked Text then Invert Bookmarks:

          4968c3eb-b556-4a09-bcd7-101e0d09958c-image.jpeg

          Invert marked text then Bookmark only lines with marked text:

          a2ad05bb-5ff2-4804-a297-d80ff34cd100-image.jpeg

          Invert bookmarks then Mark only text in bookmarked lines:

          22d172c5-69d4-4c2b-9cda-24042de57f84-image.jpeg

          The result you probably would expect only comes from Invert marked text, excluding unmarked line endings, and sync bookmarks:

          08ead0b2-7c33-4ecc-8878-5ac36b20d745-image.jpeg

          I did this with line endings displayed so you can follow what is happening. Now go back and imagine how it looks to a user with line endings not displayed.

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

            Hello, @coises and All,

            @coises, you said :

            Since Notepad++ already has an Inverse Bookmarks command, what would you think of going back to a single Invert marked text command (no sub-menu) and just leaving it to users to use the Notepad++ command and/or follow up with a command from the Synchronize marks and bookmarks menu if they want one of the other results?

            Oh, yes, of course, no need to reinvent the wheel !


            In that case, you could add, in the section speaking of the Invert marked text option within the documentation, that the Invert bookmarked lines command can be run directly from N++ and that, for a better readability, you may follow the N++ command by, either :

            • The Mark only text in bookmarked lines option

            • The Mark only text in bookmarked lines, excluding line endings option

            of the present Synchronize marks and bookmarks sub menu !

            OR the options :

            • Clear all marks, then mark all text and EOLs of the bookmarked lines

            • Clear all marks, then mark all text of the bookmarked lines, excluding EOLs

            From my suggested Synchronize marks and bookmarks sub-menu !

            Best Regards

            guy038

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

              Hi, @coies and All,

              Oh, sorry, @coises. I did not notice that you had posted something in the meantime. So, give me some minutes to understand your post !

              BR

              guy038

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

                Hello, @coises,

                Personally, after an Invert bookmarks action, I would expect a Mark only text in bookmarked lines action OR a Mark only text in bookmarked lines, excluding line endings action,as I explained in my last post !

                Best Regards

                guy038

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

                  @guy038 said:

                  OR the options :

                  • Clear all marks, then mark all text and EOLs of the bookmarked lines

                  • Clear all marks, then mark all text of the bookmarked lines, excluding EOLs

                  From my suggested Synchronize marks and bookmarks sub-menu !

                  Previously you suggested:

                  So, most of the time, taking the line-breaks in account is not necessary ! However, adding the line-breaks characters is useful as it also includes the true empty lines !


                  Thus, this would simplify the Synchronize marks and bookmarks sub-menu to the following one :

                  Bookmark only lines containing marked text
                  Clear all bookmarks, then bookmark only lines containing marked text
                  
                  Bookmark visible lines
                  
                  Mark all text and EOLs of the bookmarked lines
                  Clear all marks, then mark all text and EOLs of the bookmarked lines
                  

                  But then, just a moment ago, you wrote:

                  Personally, after an Invert bookmarks action, I would expect a Mark only text in bookmarked lines action OR a Mark only text in bookmarked lines, excluding line endings action,as I explained in my last post !

                  so it sounds like you have changed your mind (unless I misunderstood your first suggestion) and believe users do need the ability to control whether line endings are included.


                  The ideas at the front of my mind now are:

                  1. Make Invert marked text a single command (no Invert sub-menu) which does only and exactly that one thing: mark every unmarked character and unmark every marked character. No bookmark changes, and no special treatment for line ending characters.

                  2. Eliminate the “Bookmark first line of marked text” options. If you’re manipulating bookmarks based on marked text, trying to keep track of what is the “first line” is probably useless, confusing or both. (I still might remove that whole section of the Configure bookmarks dialog, too.)

                  3. For the Synchronize commands which Bookmark lines containing marked text, apply these rules:

                    • Lines containing only a line ending (empty lines) are bookmarked if the line ending is marked.
                    • Lines containing characters other than the line ending character(s) are bookmarked if any character other than the line ending character(s) is marked; the line ending is ignored.

                  That third point is clumsy to explain (and certainly won’t fit in a menu item), but I think it makes synchronizing bookmarks to marks behave sensibly without introducing variants in either Invert marked text or [Clear bookmarks and] Bookmark lines containing marked text.

                  I’m curious if you can think of situations where that would not behave as a user would expect.


                  So, back to the situation where it’s the bookmarks that are primary, and you want update marks to follow bookmarks. I gather you do think it’s important to give the user control of whether line endings are included or not.

                  Do you have specific cases or workflows in mind where each of these is useful? (I know, I’m the one that included the distinction in the first place, and now I’m trying to get rid of it if I can.)

                  And/or perhaps there should be a separate option to expand marks to full lines (that is, if there is any marked text on a line, mark the entire line), with a choice to include or exclude line endings.

                  There is also the possibility of turning Synchronize into a dialog instead of a sub-menu. That would allow for more options that could work separately or together without a huge menu of hard-to-read items, at the expense of slowing users’ workflow a bit more than a sub-menu.

                  I’m still undecided; all observations and ideas are welcome.

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

                    Hello, @coises and All,

                    I’m really sorry for the confusion. Actually, overall, I think of bookmarks in Search++ more or less the same way they’re used in N++. That is to say:

                    • Lines with bookmarks may or may not end with a line break ( cases : Mark ^.* or Mark ^.*\R )

                    • The marked text may be present or not :

                    For example, within N++, with the Bookmark line option checked, mark all lines with ^.*\R, first, then uncheck the Bookmark line option and finally use the Clear all marks button => The bookmarked lines are still present and you can act on them although no marked text exists anymore !

                    In all cases, once these bookmarked lines are copied / cutted to another location or into another file, you’ll find the exact same text !

                    Of course, the case ^.*\R should be preferred, when necessary, as it takes in account true empty lines. If the empty lines are not needed, just use the ^.+\R regex to mark the text !

                    Thus, in my previous post, I made a mistake. I should have written :

                    Personally, after an Invert bookmarks action, you may possibly use the Mark only text in bookmarked lines option, for a better coherence and readability !


                    You said :

                    The ideas at the front of my mind now are:

                    Make Invert marked text a single command (no Invert sub-menu) which does only and exactly that one thing: mark every unmarked character and unmark every marked character. No bookmark changes, and no special treatment for line ending characters.

                    Eliminate the “Bookmark first line of marked text” options. If you’re manipulating bookmarks based on marked text, trying to keep track of what is the “first line” is probably useless, confusing or both. (I still might remove that whole section of the Configure bookmarks dialog, too.)

                    For the Synchronize commands which Bookmark lines containing marked text, apply these rules:

                    Lines containing only a line ending (empty lines) are bookmarked if the line ending is marked.
                    Lines containing characters other than the line ending character(s) are bookmarked if any character other than the line ending character(s) is marked; the line ending is ignored.

                    I totally agree to these three expectations !

                    You said :

                    I’m curious if you can think of situations where that would not behave as a user would expect.

                    No, up to now, I cannot think about such situations, either !


                    You said, near the end of you post :

                    So, back to the situation where it’s the bookmarks that are primary, and you want update marks to follow bookmarks. I gather you do think it’s important to give the user control of whether line endings are included or not.

                    No, I don’t think the user control of line-endings is that important. Again, @coises, sorry for the confusion ! Actually, I think it’s better to take EOLs in account, in all cases !

                    So, don’t worry, anymore, about the necessity of distinguish the cases with OR without EOL characters ! Anyway, once the bookmarked lines are copied / cutted, it’s not the marked text which is copied / cutted but the bookmarked lines THEMSELVES !

                    Best Regards

                    guy038

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

                      Search++ version 0.7.1 is available:

                      • Fix incorrect decoding of surrogate pairs in UTF-16 files when using Search in Files.

                      • Fix failure to apply regex customizations (named classes ignore case insensitivity, \X follows Unicode standard) when searching UTF-16 files using Search in Files.

                      • Fix Replace All doesn’t add to replace box history.

                      • Improve efficiency of search in files for file encodings other than UTF-8 when the files have long lines with multiple matches per line.

                      • More accurate updates to progress (percent) monitoring in Search in Files when there are long lines with multiple matches per line.

                      • Make right-click equivalent to Shift+click in menus.

                      • Add Configure bookmarks dialog, accessible from the Tools menu, offering options regarding bookmark handling when Bookmark lines when marking text is active.

                      • Add Synchronize marks and bookmarks sub-menu on the Tools menu.

                      Help has been updated. See especially the Tools menu section for a full description the menu commands and the Configure bookmarks dialog options.

                      Comments, observations, suggestions and criticisms are most welcome!

                      Thanks to all who provided feedback on the enhanced bookmark handling design. It’s not “set in stone,” so please continue to tell me about anything that doesn’t seem right.

                      astewart77A 1 Reply Last reply Reply Quote 1
                      • astewart77A Offline
                        astewart77 @Coises
                        last edited by

                        @Coises said:

                        • Add Synchronize marks and bookmarks sub-menu on the Tools menu.

                        I see that the new Synchronize menu item

                        Bookmark visible lines

                        has changed to

                        Bookmark visible lines, and clear other bookmarks

                        In the prior version, it did not always clear other bookmarks and still does not clear them. I have been using

                        [Show]

                        followed by

                        Bookmark visible lines

                        to add bookmarks, so I like the behavior being the same as it was, but the item title doesn’t match. If it’s going to clear bookmarks, there needs to be a non-clearing item.

                        Bookmark lines when marking text
                        Add bookmarks but do not remove them.

                        made no difference.

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

                          @astewart77 said:

                          I see that the new Synchronize menu item

                          Bookmark visible lines
                          

                          has changed to

                          Bookmark visible lines, and clear other bookmarks
                          

                          In the prior version, it did not always clear other bookmarks and still does not clear them. I have been using

                          [Show]
                          

                          followed by

                          Bookmark visible lines
                          

                          to add bookmarks, so I like the behavior being the same as it was, but the item title doesn’t match. If it’s going to clear bookmarks, there needs to be a non-clearing item.

                          Thank you for catching that! You’re right: a quick check in the code shows that it does not clear preexisting bookmarks.

                          For symmetry with the other items, I think I’ll split it into two items, like the rest. When the next version comes out this item will clear old bookmarks, and there will be an Add bookmarks to visible lines that doesn’t clear.

                          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