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
      13
      4 Votes
      13 Posts
      357 Views
      CoisesC

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

      Let’s hide all the contents of a file 1, with the option in the Tools panel

      Switch to an other file 2

      Switch back to file 1

      All the lines of file 1 are visible again : I suppose that this behaviour is the one that you expect, don’t you ?

      @guy038, thank you so much for all your thoughts and your tests. They are an immense help.

      I see there is a potential problem here, without a simple solution. It looks like Notepad++ saves and restores hidden lines, but it tracks them when it hides them or shows them, so it is unaware of any changes in state made by a plugin. It not only doesn’t restore lines hidden in Search++, if you hide lines in Notepad++ and then find them in Search++, they wind up hidden again when you switch tabs away and back.

      Ugh. This could be really messy. :-(

      Let’s mark some text with the native N++ Mark dialog with the Bookmark line option checked

      If you use the Unmark All Text option of the Tools panel, it correctly clear all the marks. However, it does not clear the associated bookmarks !

      I think of two possible solutions :

      Clear all the bookmarks, as well

      Add a new Clear bookmarks option

      Unless it doesn’t work for some reason (I haven’t tried it yet), I think Notepad++’s own Search | Bookmark | Clear all bookmarks can handle that.

      May be, @coises,I just did not exactly understand the Selection concept ?

      It sounds like I need to clarify what happens a little more in the help. Short answer: the first Find selects the text it found, which wipes out the original selection; it’s not possible to search within a selection that doesn’t exist, so subsequent searches revert to searching the whole document.

      This traces back to some discussion about search in early Columns++. The purpose of having a search function there was to make it possible to search and replace in column selections, which Notepad++ search will not do. @Alan-Kilborn observed some unexpected behavior and suggested using what Scintilla calls an indicator. (Notepad++ calls it marked text or a style… both style and mark mean something different from indicator in Scintilla, so keeping the words straight is an ongoing challenge.)

      The fundamental operation of Find (step-wise) is to select what was found. You can’t have a selection within a selection; the original selection is lost when you do the first Find. My original attempt at solving this in Columns++ — by “memorizing” the original selection and using it for subsequent finds — did not work well. After Alan’s suggestion, I switched to “Search in Indicated Region” and set a marked region from the column selection. Eventually I wound up with some features for controlling the indicated region incorporated into the search dialog, and some complicated rules (described here under the heading “Other controls in the Search dialog”) to make it so that users can almost forget about the indicator, even though every search in Columns++ must happen within an indicated region.

      One of my goals in Search++ was/is to get rid of the imposition of an “indicated region” (now just called “marked text”) on users who aren’t thinking in those terms.

      The rough equivalent to Selection -> Region | Auto set in Columns++ (which is checked by default) is Settings | Convert selections to marked text before beginning a stepwise search in Search++ (which is not, at present, checked by default).

      Given my experience with Columns++, I don’t plan to attempt to restrict search to a “memorized” selection that no longer exists. Either you convert the selection to marked text, let Search++ convert it for you, or only the first step-wise Find will be confined to the original selection.

    • JAKJ

      How to compare 2 text files and delete duplicates

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      11
      0 Votes
      11 Posts
      527 Views
      guy038G

      Hi, @jak, @peterjones, @pnedev, @phil-pascal and All,

      Ah…, OK :! But it’s quite funny, @jak, because it’s exactly what I proposed in my last two posts !!!

      Giving the initial contents of your two files :

      The Original Music Collection which contains : Coldplay yellow Elton John Rocket man Beatles abbey road Beatles Love me do Beatles hey Jude Monkees daydream believer The New Music file which contains : Beatles abbey road Beatles Love me do Beatles hey Jude Monkees daydream believer The move blackberry way (1) By running a search/ replacement with regular expressions :

      I append, at the very end of the New music file, the contents of the Original Music Collection file, after a line of, at least, 3 equal signs, giving this temporary New music file :

      Beatles abbey road Beatles Love me do Beatles hey Jude Monkees daydream believer The move blackberry way ========== Coldplay yellow Elton John Rocket man Beatles abbey road Beatles Love me do Beatles hey Jude Monkees daydream believer

      Now :

      Switch to the New Music file

      Open the Replace dialog ( Ctrl + H )

      Uncheck all box options

      SEARCH (?x-is) ^ (.+\R) (?= (?s) .+? ^===+ .+ ^ \1) | (?s) ^ ===.+

      REPLACE Leave EMPTY

      Tick the Wrap around option

      Select the Regular expression search mode ( IMPORTANT )

      Click on the Replace All button

      => You should get your expected New Music file, below :

      The move blackberry way Save the modification of the New Music file (2) By using the ComparePlus plugin :

      First, use the Plugins > ComparePlus > Diff Visual Filters... option

      Check the Hide added/removed lines option and valid this choice with the OK button

      Then, use the specific option Plugins > ComparePlus > Find Unique lines

      Now, select the New Music file ( IMPORTANT )

      Run the Plugins > ComparePlus > Delete all/selected visible lines option

      Run the Plugins > ComparePlus > Clear Active Compare option

      Finally, save the modifications of the New Music file ( IMPORTANT )

      Best Regards,

      guy038