Community
    • Login
    1. Home
    2. Popular
    Log in to post
    • All Time
    • Day
    • Week
    • Month
    • All Topics
    • New Topics
    • Watched Topics
    • Unreplied Topics
    • All categories
    • CoisesC

      Search++: A work in progress

      Watching Ignoring Scheduled Pinned Locked Moved Notepad++ & Plugin Development
      45
      4 Votes
      45 Posts
      2k Views
      CoisesC

      @guy038 said in Search++: A work in progress:

      This still one point that’s a bit unclear to me : what is the fundamental difference between all these options, when compared in pairs :

      The principle (see the last bullet point under help for search scopes) is that commands which don’t specify a scope search in marked text if there is any; otherwise, in the current selection if it is not empty; otherwise, in the whole document. That’s subject to the Settings: if you unchecked both Automatically search within selections and Automatically search within marked text, then all the pairs of commands you listed would be identical; and there are the limits on when selections are considered “large enough” to trigger search within selection. (A selection that is the immediate result of a stepwise search never causes the same search to search within that selection no matter how large it is.)

      There are two special cases, and a third questionable feature, also involved:

      There are no Before or After commands with in Selection scope. (My logic is that something can’t be both in the selection and before or after it.) So search commands that include Before or After can only be in Marked Text or in Whole Document.

      Mark commands that don’t specify a scope don’t automatically scope to in Marked Text even if Automatically search within marked text is enabled. What happens is that unless you’ve checked Always unmark all text before Mark command, default Mark commands add to existing marks. I know this is a different behavior from selections, but I think because selections are so volatile, and marks are not, it is natural to use them in different ways. Should this exception be an option in Settings? I’m inclined to add it as a default-checked sub-option of Automatically search within marked text.

      Search commands that specify in Selection or in Marked Text search the whole document if there is no (non-empty) selection or marked text. I’m questioning the sense of that now. I’m thinking that if the user specifies “in selection” or ”in marked text,” and there is none, the search should fail with a message like “No marked text to search” rather than silently discarding the specified scope.

      Thoughts about that logic, especially point 3 (which I am inclined to change in the next release) are welcome and encouraged.

      I have tried to keep as much “symmetry” as I could, to make it all more comprehensible. I think it is possible that I have created some nonsense in practice.

      Points 1 and 3 together mean that Before and After commands without a scope are either the same as Before/After in Marked Text if Automatically search within marked text is checked, or the same as Before/After in Whole Document if it isn’t. However, as I wrote, I’m questioning point 3; without that, when the relevant setting is checked, there would be a difference (the commands that don’t specify a scope would switch between in Marked Text and in Whole Document depending on whether there was any marked text in the document, whereas neither command that specified one scope would switch to the other).

      So… looking at the full list you gave, group by group, assuming default settings… this is what is supposed to happen (full testing of every possible case has not been done):

      Find vs Find in Whole Document Find Backward vs Find Backward in Whole Document

      The two on the left will find the next match in marked text following or preceding the current position or selection if any text is marked; otherwise they will find the first or last match in the selected text if “enough” text is selected; otherwise they will find the next match following or preceding the current position or selection in the whole document. Those on the right will always find the next match following or preceding the current position or selection in the whole document regardless of whether any text is marked or selected.

      Count vs Count in Whole Document

      Count will count only matches in marked text if any text is marked; otherwise it will count only matches in selected text if “enough” text is selected; otherwise it will count all matches in the whole document. Count in Whole Document will always count all matches in the whole document regardless of whether any text is marked or selected.

      Count Before vs Count Before in Whole Document Count After vs Count After in Whole Document

      The two on the left will count only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will count matches before or after the current position or selection in the whole document. Those on the right will always count matches before or after the current position or selection in the whole document regardless of whether any text is marked.

      Find All Before vs Find All Before in Whole Document Find All After vs Find All After in Whole Document

      The two on the left will list only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will list all matches before or after the current position or selection in the whole document. Those on the right will always list all matches before or after the current position or selection in the whole document regardless of whether any text is marked.

      Select Before vs Select Before in Whole Document Select After vs Select After in Whole Document

      The two on the left will select only matches in marked text that are before or after the current position or selection if any text is marked; otherwise they will select all matches before or after the current position or selection in the whole document. Those on the right will always select all matches before or after the current position or selection in the whole document regardless of whether any text is marked.

      Mark Before vs Mark Before in Whole Document Mark After vs Mark After in Whole Document

      I’ll double-check my logic later, but I think these are identical, since (1 above) Before/After can’t be in selection, and (2 above) Mark doesn’t automatically scope to marked text. It’s unclear to me which ones to remove, since either choice breaks the symmetry and could be confusing to users, but having two commands that do the same thing is also confusing.

      Show Before vs Show Before in Whole Document Show After vs Show After in Whole Document

      I grant that this would be a strange use of Show. In the circumstance where there are hidden lines both before and after the current position or selection, and there is some marked text in document, the ones on the left would search only marked text before or after the current position or selection for lines to unhide, while the ones on the right would search all text.

      Replace and Find vs Replace And Find in Whole Document Replace and Find Backward vs Replace and Find Backward in Whole Document Find or Replace vs Find or Replace in Whole Document Find Backward or Replace vs Find Backward or Replace in Whole Document Replace All vs Replace All in Whole Document Replace All Before vs Replace All Before in Whole Document Replace All After vs Replace All After in Whole Document

      These are like their Find and Find All counterparts. The ones on the left work like “in Marked Text” if any text is marked; otherwise, like “in Selection” if “enough” text is selected; otherwise like “in Whole Document” (like the ones on the right).

    • R

      No-save buffer, for log barf I don't want to save

      Watching Ignoring Scheduled Pinned Locked Moved General Discussion
      2
      0 Votes
      2 Posts
      35 Views
      PeterJonesP

      @robstoddard ,

      Personally, I just have a file named Peter's Scratchpad.txt that’s always open, where I paste things like that (and, admittedly, things that started like that but have just stayed around in that file for a lot longer than originally intended). And if I save the “temporary data” in the file, who cares? I just delete the stuff out of the file that I don’t need anymore when I don’t need them anymore. That way, I can just Save All or use the Auto-Save plugin as much as I want, without having to ask for a specific feature to “not save this one thing”.

    • donhoD

      All the off-topic go here

      Watching Ignoring Scheduled Pinned Locked Moved Boycott Notepad++
      8
      3 Votes
      8 Posts
      6k Views
      guy038G

      Hello, @datatraveller1 and All,

      Many thanks for joining the Compare2Lists’s author and many thanks to Fatih Ramazan Çıkan which was able to get a quick new 1.7 version which fixes this annoying bug !

      I also tried this software on that real example that I proposed in this post, some days ago :

      https://community.notepad-plus-plus.org/post/105031

      You can download this file from my Google Drive account :

      https://drive.google.com/file/d/1aYOpKon4KYw_NXSdj4Tm4Ti_FrygC2ky/view?usp=sharing

      Before using it with the Compare Two Lists software :

      Delete the last column, which counts the number of records, with a column mode selection

      Delete all trailing blank characters with the Edit > Blank operations > Trim Trailing Space option

      Place all contents in the clipboard ( Ctrl + C )

      Now, open the Compare Two Lists software

      Paste all the resulting contents with the Paste button, associated with the List #1 panel

      Check that the Settings > Cas sensitive option, if necessary

      Click on the Remove Duplicates button, associated with the List #1 panel

      => You should see that it remains 50,822 records

      And this is exactly the results produced when you use the cases #3 or #4 of my post ;-))

      Best Regards,

      guy038