Search++: A work in progress
-
Hello, @coises,
For, the tests below, I needed, of course, to un-check the
Always unmark all text before Mark command. (Otherwise add to existing marked text.)option in SettingsRegarding the present
Synchronize marks and bookmarkssub-mneu, below :Add a bookmark to each line with marked text Add a bookmark to the first line of each span of marked text Bookmark only lines with marked text Bookmark only the first line of each span of marked text Bookmark visible lines Add marks to all text in bookmarked lines Mark only text in bookmarked lines Add marks to all text in bookmarked lines, excluding line endings Mark only text in bookmarked lines,excluding line endingsTwo observations :
1 I don’t think that the options which mark only the first line of each span of marked text are really useful. Actually, the goal is more to mark all the lines that meet a certain criterion, in order to navigate between these lines, copy / cut theses lines for pasting in a other location or file or deleting these ones !
2 With native N++, whatever you use the
^.*or^.*\Rregex to mark AND boomark lines, then using theCopy Bookmarked linesof N++ and pasting in an other document, even with an other kind ofEOL, just paste the bookmarked lines according to theEOLof the pasting documentSo, 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 bookmarkssub-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
Now, regarding the present
Invert marks or bookmarkssub 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 endingsThis time, I would avoid any option that excludes the
EOLsand 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 textRemarks :
-
The letters preceding the options serve to link this present submenu to the future possible submenu !
-
Note that running, consecutively, the
AandBactions is equivalent to theDaction -
Note also that in these two sub-menus, I specified, when necessary, the two consecutive steps to make it easier to understand :
For example :
-
Clear all bookmarks, then bookmark only lines containing marked text
-
Clear all marks, then mark all text and EOLs of the bookmarked lines
-
D Invert bookmarks, then mark all text and EOL of the bookmarked lines
-
C Invert marked text, then bookmark all lines containing marked text
It’s easier to see the first action done : on the bookmarks OR on the marks
BR
guy038
Again, I forgot to thank you for the fix when you do a first right-click within the
FindorReplaceboxes ! -
-
Hi, @coises,
Oh…, my God, I’m just realizing that I did all my previous tests with the main
Bookmark lines with marking textoption OFF, so with theSearch++ Configure bookmarkdialog all greyed !Thus, my tests are quite incomplete :-(( I’ll continue testing … !
BR
guy038
-
Hello, @coises and All,
Thus, I chose these options within the
Search++: Configure bookmarksdialog :
And ultimately, given the chosen options, the only differences are :
-
When you mark something, it automatically bookmarks the associated line
-
When you unmark something, it automatically removes the bookmark of the associated line
Best Regards
guy038
-
-
And ultimately, given the chosen options, the only differences are :
-
When you mark something, it automatically bookmarks the associated line
-
When you unmark something, it automatically removes the bookmark of the associated line
Yes, that is one of the changes from 0.7.0.1 to 0.7.0.2, that Invert and Synchronize (previously commands, now sub-menus of commands) are no longer affected by the Configure bookmarks settings at all. That made it sensible to put all the settings under Bookmark lines when marking text. and disable them when that option is unchecked.
-
-
For, the tests below, I needed, of course, to un-check the
Always unmark all text before Mark command. (Otherwise add to existing marked text.)option in SettingsI don’t know if it’s clear, but that only affects Mark search commands. It doesn’t affect any commands on the Tools menu.
There are two times when a successful Mark search command unmarks existing text first. (A command that doesn’t find a match never unmarks.) One is when that option is checked: in that case, all Mark search commands clear existing marks before marking matching text. The other case is Mark in Marked text. When that command is chosen or defaulted, existing marks are cleared before marking the first match regardless of whether Always unmark… is checked, because otherwise the command could not accomplish anything: it would only be marking text that is already marked.
The Configure bookmarks option Mark commands that unmark before searching also clear bookmarks. is related to this. If either of the above cases applies and that box is checked and Bookmark lines when marking text is checked, bookmarks are cleared as well as marks.
Hopefully that does what most people would want and expect without them having to think through all those details.
Regarding the present
Synchronize marks and bookmarkssub-mneu, below :Add a bookmark to each line with marked text Add a bookmark to the first line of each span of marked text Bookmark only lines with marked text Bookmark only the first line of each span of marked text Bookmark visible lines Add marks to all text in bookmarked lines Mark only text in bookmarked lines Add marks to all text in bookmarked lines, excluding line endings Mark only text in bookmarked lines,excluding line endingsTwo observations :
1 I don’t think that the options which mark only the first line of each span of marked text are really useful. Actually, the goal is more to mark all the lines that meet a certain criterion, in order to navigate between these lines, copy / cut theses lines for pasting in a other location or file or deleting these ones !
Yes, I have wondered if any of that, in the Synchronize sub-menu or in the Configure bookmarks dialog, is useful. It was how I expected bookmarks would work with search and that’s how I first implemented it; then I saw that Notepad++ doesn’t just bookmark the lines where each match began, it marks every line containing any part of a match.
I suspect it’s a lot less common to search for matches that span multiple lines than for matches contained in a single line, so maybe few people even notice the difference.
I think I would either leave it in both the Configure bookmarks dialog and the Synchronize menu or take it out of both. I left it out of the Invert sub-menu because I couldn’t figure out a way to make it make much sense when doing inversion with bookmarks.
2 With native N++, whatever you use the
^.*or^.*\Rregex to mark AND boomark lines, then using theCopy Bookmarked linesof N++ and pasting in an other document, even with an other kind ofEOL, just paste the bookmarked lines according to theEOLof the pasting documentSo, 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 bookmarkssub-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 linesI have to think about this some more. I can agree that having line endings / no line endings variants in those menus makes them more complex to read and use.
Inverting marked text can yield some strange results. For example, say you matched a full line, but not its line ending, so it alone is marked and bookmarked. Now you Invert marked text and sync bookmarks. The line ending on that line wasn’t marked, so when you invert marks it is marked; since there is a mark on the line (though you can’t see it if you don’t show line endings), the line is also bookmarked. Every line in the document is now bookmarked, including the originally marked and bookmarked line that now has no visible marks (they’re hidden along with the line endings).
Though I don’t think I should ignore line endings on the programming side — as per my example above — it could be that I can “hide” the unexpected behavior from users so they don’t have to think about it. The tricky bit is being confident that I really have covered all the cases that would be confusing to a user if I don’t force them to think about line endings.
-
This time, I would avoid any option that excludes the
EOLsand 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
AandBactions is equivalent to theDaction
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.
- Note that running, consecutively, the
-
Now, regarding the present
Invert marks or bookmarkssub 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 endingsThis time, I would avoid any option that excludes the
EOLsand 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 textSince 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?
-
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.
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:

Invert marked text then Bookmark only lines with marked text:

Invert bookmarks then Mark only text in bookmarked lines:

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

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.
-
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 textoption within the documentation, that theInvert bookmarked linescommand 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 linesoption -
The
Mark only text in bookmarked lines, excluding line endingsoption
of the present
Synchronize marks and bookmarkssub 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 bookmarkssub-menu !Best Regards
guy038
-
-
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
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