@guy038 said:
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 Settings
I 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 bookmarks sub-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 endings
Two 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 ^.*\R regex to mark AND boomark lines, then using the Copy Bookmarked lines of N++ and pasting in an other document, even with an other kind of EOL, just paste the bookmarked lines according to the EOL of the pasting document
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
I 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.