Search++: A work in progress
-
Search++ version 0.7 is available:
-
Use different styles for Mark and Show. This helps keep Mark and Show cleanly separated, and it makes Always hide all lines and remove Show style from text before Show command behave more as one would expect with the default scope Show command, without introducing an inconsistency with the way other default scope commands behave.
-
Add several commands to the Tools menu, including support for the new Show style and more ability to manipulate Marked text. Some shortcuts have changed: most underlined menu characters and associated shortcut keys now match.
-
Expand visible on the Tools menu gives a rudimentary ability to show context for matches when using the Show command. Each expand visible action adds a line to the beginning and end of each visible block of text.
-
Add Find, Replace and Show tools to the main plugin menu. These commands are not very useful from the menu itself, but adding them makes it possible to set Notepad++ keyboard shortcuts for them.
-
Correct a fault in Show All Lines from the Tools menu that caused unexpected scrolling behavior. Improve the logic for vertical positioning when using Show All Lines.
Comments, criticisms, bug reports and questions as to what the hell I could have been thinking are, as always, most welcome.
The biggest change in this release is making Show more useful. Since Show no longer “marks” text but uses a different style to highlight matches, I expect the two concepts to interfere less. Show now uses a second indicator (matched to the color of the selected show style) so that it can, with some limitations, show zero length matches.
Previously, the setting Always hide all lines and remove Show style from text before Show command did what it was designed to do, but the design wasn’t very good, because leftover marks from a previous Show still affected the scope of a subsequent default Show command. Separating the mark and show styles fixes that, so the setting now causes Show commands to clear the results of any previous show, as one would expect.
Another thing that inhibited the use of Show was that you had to use both Remove marks from active document and Show all lines from the Tools menu to clear the results of a Show, and Show all lines had an annoying bug that screwed up vertical positioning after you used it. That bug is fixed, and a new command, Clear show (show all and clear style), resets the effect of Show all at once.
I expanded the Tools menu with several new commands; how useful they all are can only be discovered from experience.
The new Expand visible command on the Tools menu works with Show to make it possible to see a list of matches with some context: each time you click Expand visible (or use the Ctrl+P shortcut) each block of visible text is expanded to include the line before it and the line after it.
The addition of Find and Replace on the main plugin menu makes it possible to set shortcuts for the stepwise search commands. If you don’t typically use Alt+F and Alt+R to access the File and Run menus in Notepad++, you might try assigning those as shortcuts for Search++ Find and Replace and checking Settings | Focus the document after stepwise Find or Replace commands. The result is that you can use Alt+F or Alt+R to begin a search, have keyboard focus go immediately to the document, then continue to use the same key combinations to move through matches in the document. (This is somewhat like the behavior of F3 in Notepad++.)
-
-
But, even though I unckecked, both, the
Default commands automatically search within selectionsand theDefault commands automatically search within marked textoptions and valid the new settings with theOKbutton, after selected some text containing ONLY one occurrence of the search, theCount in Selectionstill give1match only and not the totality of the matches of the current fileThen, using the
Add Selection to Marked Textoption to mark all the selection raange (Ctrl + M), again, theCount in Marked Textreturns1match, instead of the totality of the matches. Is this expected or a bug as the scope should beWhole Document?The Default commands automatically… settings only affect commands with default scope. What happens when you uncheck one or both of those settings is that the commands with default scope:
Find
Find Backward
Count
Find All
Select
Mark
Show
Replace
Replace Backward
Replace All
pay no attention to whether there is a selection (if …within selections is unchecked) and/or marked text (if …within marked text is unchecked), and just search the whole document.Commands that specify a scope, like Count in Selection or Count in Marked Text, still do what their name says they do.
-
What prompted me to suggest another solution is that you seemed really frustrated with how your plugin works,
I do appreciate your suggestions, even if I don’t immediately adopt them as written. Anything you can tell me that sheds light on your experience with the interface and how it seems like it should work can help me find new solutions.
Anyway, as you said, menus seem preferable. However, I still think that a layout with the six buttons Find, Count, Find All, Select, Mark and Show could be easier to use ( Personally, I’m ready to test a forked version, if you think it’s worth it )
This would simplify the number of menus :
I can see how splitting the Find All button into four buttons (one each for Find All, Select, Mark and Show) would make the interface simpler, in that it would get rid of the need for sub-menus on those buttons. (And as you’ve pointed out, the [Do not] Jump to next match sub-menu on Replace isn’t really needed.) I’m not convinced yet, but it’s not out of the question, either.
My “default scope” (or “adaptive scope”) notion is a kind of extension of Notepad++’s Settings | Preferences | Searching | Minimum Size for Auto-Checking “In selection”. Since the docking version of the Search++ dialog might rarely if ever be closed and reopened during a session (I leave it open all the time), just choosing the setting when the dialog opens wouldn’t be much help: I wanted something that adapts to changing conditions, but that the user can still override when necessary. And I wanted it to handle selections and marked text similarly. It’s meant to make it so that usually you can just click a button and have it do what you would want it to do.
-
Hello, @coises,
You said :
What happens when you uncheck one or both of those settings is that the commands with default scope:
and :
Commands that specify a scope, like Count in Selection or Count in Marked Text, still do what their name says they do.
Thus, before downloading your new
Search++ version 0.7release, I ran a few more tests, and honestly, I was wrong about that. It’s kind of like I’m rediscovering the true concept of yourdefault scope!!So when, BOTH, the
Default commands automatically search within selectionsand theDefault commands automatically search within marked textoptions are unchecked, in Settings :-
The default
Findaction is identical to theFind in Whole documentaction -
The default
Countaction is identical to theCount in Whole documentaction -
The default
Find allaction is identical to theFind All in Whole Documentaction -
The default
Selectaction is identical to theSelect in Whole Documentaction -
The default
Markaction is identical to theMark in Whole Documentaction -
The default
Showaction is identical to theShow in Whole Documentaction -
The default
Replaceaction is identical to theReplace in Whole Documentaction -
The default
Replace allaction is identical to theReplace All in Whole Documentaction
Now, many thanks, @coises, for this new release ! Indeed, the
Showfeature has been completely redesigned and the addition of a separate style, different from theMarkfeature is a good improvement !However, I needed some time to understand what meant the option
Show selected lines (Shift: All) Ctrl + Q, in theToolsdialog ! Luckily, with theSearch++documentation, I understood the difference betweenCtrl + QandCtrl + Shift + QWould it be more simple to write the two lines :
Show selected lines Ctrl + Q Show all lines Ctrl + Shift + QInstead of that single line ( which sometimes seems wrongly labelled
Show all lines Ctrl + Q )?!
Your new
Expand visible Ctrl P, in theToolsmenu, is really a nice feature. I would suggest to label this optionShow one more line before and afteras this command can be repeated !BTW, do you plan to add, in the future, such a feature to the
Find Allfunctionality ?
Now, let’s say that I marked
15occurrences of some text. As I checked theBookmark lines when marking textoption, I got15blue marks. If I use your newInvert marked text, all non-marked text get marked and all marked text becomes unmarked : OKHowever, the bookmarks do NOT follow this new marked text. In addition, may be the option
Invert marked Lineswould be more interesting ! Or, possibly, the two options ?Best Regards,
guy038
-
-
It’s kind of like I’m rediscovering the true concept of your
default scope!!Your observations are correct. I think you get how it works now… which leaves me with the problem: How do I make this obvious to users who are not going to spend nearly as much time as you have spent to understand it?
Perhaps you see why I think it is useful: not having to constantly use a menu (or a dialog) for routine things like searching in a selection, or marking text and then finding or replacing within the marked text. Also, the Settings allow users to customize it to the way they work most often.
Yet, it loses its usefulness if it is a puzzle to know when it will do what, and you have to use the drop-down anyway because you aren’t sure what the default command will do. I’m still working toward finding a design that is efficient for power users, obvious for casual users, and predictable for everyone, while remaining visually appealing.
However, I needed some time to understand what meant the option
Show selected lines (Shift: All) Ctrl + Q, in theToolsdialog ! Luckily, with theSearch++documentation, I understood the difference betweenCtrl + QandCtrl + Shift + QWould it be more simple to write the two lines :
Show selected lines Ctrl + Q Show all lines Ctrl + Shift + QInstead of that single line ( which sometimes seems wrongly labelled
Show all lines Ctrl + Q )?!Without going into a lot of details, it comes down to economy of underlined letters for the menu options. (I’m reserving S, and the keyboard combination Ctrl+S, for save search.)
The menu option is labeled Show all lines when the selection (or caret if nothing is selected) occupies only lines that are already visible. In this case, there is no need to require Shift to show all lines, since showing selected lines would do nothing. It is labeled Show selected lines (Shift: all) when the selection includes text on a hidden line; then without Shift the command shows the selected line, but if you really wanted to show all lines, you can press Shift when you click to do that.
Mark selected text and Mark shown text have a similar dual function. If any text is already marked, they show (Shift: clear first) in the menu item. Using Shift clears existing marks first, while not using Shift adds to the existing marks.
All of these have keyboard accelerators using the same letter with and without the Shift key, which duplicate the functions of the menu commands.
Your new
Expand visible Ctrl P, in theToolsmenu, is really a nice feature. I would suggest to label this optionShow one more line before and afteras this command can be repeated !(It might seem silly, but running out of letters, I spent some time thinking of a way to use “p” before I came up with “Expand” for this option. “P” was one of the few letters that was unused in both upper and lower case as a keyboard accelerator, and I plan to add a (Shift: details) option, or something similar, allowing the user to do multiple lines at a time, or different numbers of lines before and after, or perhaps something else… I haven’t decided.)
BTW, do you plan to add, in the future, such a feature to the
Find Allfunctionality ?I hope to do that, but unlike Show, I expect that it will be necessary to specify the amount of context to be shown before and after each match before executing the Find All command.
Now, let’s say that I marked
15occurrences of some text. As I checked theBookmark lines when marking textoption, I got15blue marks. If I use your newInvert marked text, all non-marked text get marked and all marked text becomes unmarked : OKHowever, the bookmarks do NOT follow this new marked text. In addition, may be the option
Invert marked Lineswould be more interesting ! Or, possibly, the two options ?I’ve been a little uncertain how to handle bookmarks. I don’t generally use bookmarks in Notepad++ at all, so I don’t have much sense of how people use them.
I suppose that when Bookmark lines when marking text is checked, bookmarks should follow marks. But what if you already had some bookmarks, and then you added some more when marking text. Then you do something like Invert marked lines because you want to search for something in the remaining text — are you likely to accidentally lose bookmarks you set because you forgot to turn off Bookmark lines when marking text first? (Strictly speaking, you wouldn’t lose them, but they’d be mixed in with all the other previously unmarked lines, so in effect they would be lost.)
What do you think? My thought was that the reasonable use case for Invert marked text is to restrict a search to what wasn’t found in a previous search, and that carrying bookmarks along would be more likely to be an oversight than something you wanted to do.
-
Hi, @coises and All,
You said :
I’m still working toward finding a design that is efficient for power users, obvious for casual users, and predictable for everyone, while remaining visually appealing.
Good luck in the quest for this Holy Grail !!!
Now, is the following behavior a bug:
-
I previously checked the
Bookmark lines when marked textin theToolsmenu -
Then I do a simple selection of some lines of text
-
I use the
Mark selected textoption ( orCtrl + M)
=> Only the first line of the selection is bookmarked ( instead of each line of the selection ). It’s also the case if the file contains previous marked text and if I use the
Ctrl + Shift + Moption
You said :
(It might seem silly, but running out of letters, I spent some time thinking of a way to use “p” before I came up with “Expand” for this option. “P” was one of the few letters that was unused in both upper and lower case …
OK. So, perhaps you’ll agree with this new wording
Expand to one more line before and after, waiting for theShift(details)option. Allow me to proposeExpand to five lines before and after Ctrl + Shift + P. This would be a good compromise !
You said :
I’ve been a little uncertain how to handle bookmarks. I don’t generally use bookmarks in Notepad++ at all, so I don’t have much sense of how people use them.
Unlike you, I use bookmarks very OFTEN to isolate or delete portions of text. After marking some text, I mainly use the context menu by right-clicking within the bookmarks margin. For example :
-
I mark and bookmark sone lines of text for a specific occurrence. Then I copy all these lines and paste them in a new tab for further review
-
I mark and bookmark sone lines of text for a specific occurrence. Then I can either delete them or delete the non-bookmarked lines
-
I mark and bookmark sone lines of text for a specific occurrence. Then I cut them and paste all these bookmarked lines in an other location of the same file
-
After a sort, I mark and bookmark the duplicate lines of a file. Then I have two possibilities :
-
I delete all the bookmarked lines in order to keep only the unique lines
-
I invert the bookmarked lines and copy the unique lines in a new tab for further review
-
There’s just one option that I rarely use : the
Paste to (Replace) Bookmarked Lineswhich replaces each bookmarked line by the contents of the Clipboard !
There’s one thing that bothers me about your Invert marked text option :
- Let’s imagine the text, below, pasted in a new tab :
bla blah This is the test to do bla blah test bla blah-
Select the N++
Show All Charactersoption -
Mark, with
Search++, the two wordstest -
Now, use the option
Invert marked text:-
The first line of the file is wrongly bookmarked ( bug ? )
-
The two line-breaks, after each word
test, are also bookmarked
-
Compare by pasting the above text in a second tab, use the native N++
Markcommand and then theInvert Bookmarksoption of the Bookmark margin context menu ( In fact, anInvert Bookmarked Linesoption ).Thus, I think that you should add the
Invert bookmark linesoption, in theToolsdialog. Then :-
By using the
Invert bookmarked textoption, the results would be the SAME as they are now ! And the present bookmarks would remain as is. -
By using the
Invert bookmark lines Ctrl + Shift + L, the bookmarked lines would be inverted, but the marked text would remain as is, like with native N++ !
Best Regards,
guy038
-
-
Now, is the following behavior a bug:
-
I previously checked the
Bookmark lines when marked textin theToolsmenu -
Then I do a simple selection of some lines of text
-
I use the
Mark selected textoption ( orCtrl + M)
=> Only the first line of the selection is bookmarked ( instead of each line of the selection ). It’s also the case if the file contains previous marked text and if I use the
Ctrl + Shift + MoptionUnlike you, I use bookmarks very OFTEN to isolate or delete portions of text. After marking some text, I mainly use the context* menu by right-clicking within the bookmarks margin. For example :
-
I mark and bookmark sone lines of text for a specific occurrence. Then I copy all these lines and paste them in a new tab for further review
-
I mark and bookmark sone lines of text for a specific occurrence. Then I can either delete them or delete the non-bookmarked lines
-
I mark and bookmark sone lines of text for a specific occurrence. Then I cut them and paste all these bookmarked lines in an other location of the same file
-
After a sort, I mark and bookmark the duplicate lines of a file. Then I have two possibilities :
-
I delete all the bookmarked lines in order to keep only the unique lines
-
I invert the bookmarked lines and copy the unique lines in a new tab for further review
-
Thank you for these observations and clarifications. I see that I have misunderstood how bookmarks are used.
I had assumed the purpose of a bookmark was to make it possible to scroll quickly to locations you expect to want to find again (like putting a bookmark in a physical book). What you wrote tells me they are (also?) used as a way of marking whole lines to be processed differently from the remaining lines.
I added the Bookmark lines when marking text option when it was requested. (I think you requested it, and maybe someone else, too.) I see now that I didn’t implement that request correctly, or at least not the way Notepad++ does it. When marking matches that span multiple lines, Notepad++ puts a bookmark on every line involved in each match. In Search++, only the line where each match starts is bookmarked.
That came from my misunderstanding, thinking the only purpose of bookmarks was to find something easily. Since I thought that was how bookmarks were used, I kept the same idea when marking a selection: Search++ bookmarks only the first line (or the first line of each part of a multiple selection).
(Adding to the confusion, I forgot what was in my own code when I answered you about Invert marked text. I gave an explanation of why it doesn’t change bookmarks; but it does change bookmarks when Bookmark lines when marking text is checked. It clears all bookmarks and then puts a bookmark at the beginning of each contiguous span of marked text. That does exactly what I argued in my last post should not happen: it loses any individual bookmarks you might have set apart from those set by marking text.)
I will need to reconsider everything I do with bookmarks.
Some questions, not just for Guy but for anyone who uses bookmarks:
Is marking lines for processing, the way Guy describes, pretty much the only way people use bookmarks?
Or do you also (or instead) use bookmarks for navigation?
Is optimal behavior for the two uses different (e.g., bookmarking all lines that are part of a match, as Notepad++ does, versus marking only the beginning of a match, as Search++ does now)?
If you use “bookmark lines” when marking text (either in Notepad++ or Search++), is that a way of working in which you expect bookmarks to follow marked text? Or do you specifically want the search process to bookmark lines, but otherwise think of bookmarks and marked text as independent things?
-
-
Is marking lines for processing, the way Guy describes, pretty much the only way people use bookmarks?
Or do you also (or instead) use bookmarks for navigation?
Me personally, I almost never “bookmark” from the Mark dialog. I bookmark a line from the GUI (clicking in the margin) when I want to be able to navigate there when doing related edits in two or three different sections of code. But that’s my usage.
I know I’ve seen lots of posts here where people like using the bookmarks – especially across multiple lines – to make use of the Search > Bookmark > xxx Bookmarked Lines , and that’s often given as advice for some of the convoluted search needs that come up here.
So making sure it works under both use cases is probably a good idea.
-
Or do you specifically want the search process to bookmark lines, but otherwise think of bookmarks and marked text as independent things?
I make use of bookmarks because they are saved in sessions. Marks and changed line indicators are not. I mark some things with bookmarks, turn mark with bookmarks off, clear marks, do stuff … mark some other things with bookmarks, save session. Then I can use bookmarks later to review the areas I have been looking at.
-
Hello, @coises, @peterjones, @astewart77 and All,
Of course, regarding my bookmarks’s use, I also, very often use them, as described by @peterjones, to easily reach specific locations, in current file which, indeed, are kept from current session to the next one, as long as you keep this current file opened in the current session and that you close and restart Notepad++, in order to save these bookmarked lines in
session.xmlfile !In addition, when I marked all the occurrences of a specific search, it’s quite easy to navigate between them, using the
F2andShift + F2shortcut to reach the next / previous bookmarked line ! Once again, you’ll need to close and restart N++ => All the bookmarks of the previous search are kept but, of course, the REDMarkstyle of each occurrence has now disappeared !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