Can I see a preview for the result of the "replace" form?



  • Can I see a preview for the result of the “replace” form?

    8f55cdf8-dcbd-4aa1-8cc5-729b9af0dead-image.png



  • @Aliaksandr3by

    I assume that you ask this regarding the RegexTrainer, correct?
    If so, I don’t see that it has such a feature. Maybe you can open
    a feature request here and the author of the plugin has the time to implement it.
    But there is one thing you have to consider.
    From what I see, this plugin uses dot.net and therefore I assume that it uses the regex engine of dot.net.
    Npp uses boost::regex, so it could be that the regex syntax is a bit different.



  • @Ekopalypse

    no, i ask about the native feature of n++.
    I need to see a preliminary results of replace.

    5db0313a-5954-41fb-b3ce-64e1760a2db6-image.png



  • @Aliaksandr3by

    No, unfortunately npp does not have a feature to get a preview for a replace operation.
    For an implementation I also see difficulties like

    • File size could cause problems
    • Files would have to be locked in order to guarantee the result


  • @Aliaksandr3by

    What version of Notepad++ has a Find All in Current Document on the Replace tab ??

    I was going to elaborate on an idea to use the Compare plugin as a solution to the original query, but I looked at the plugin’s website ( apparently https://github.com/jsleroy/compare-plugin ) and the most-recent change is 3.5 years or so ago.

    I’m sure there has to be more-recent changes to this plugin?
    Anyone know?



  • I think the that the picture is a mock up.
    Install compare from plugin manager then you get the most current/actual version provided by @pnedev. Here is his repo.



  • @Ekopalypse said in Can I see a preview for the result of the "replace" form?:

    I think the that the picture is a mock up.

    Then, a confusing mock up! :-)

    Install compare from plugin manager

    Of course you mean Plugins Admin

    But yes…
    Usually when I’m looking at a new plugin to install, or to give advice concerning a plugin, I’ll first go to check out latest developments on that plugin.

    I was surprised to see the site listed in Plugins Admin for the Compare plugin was one that had 3.5 year old code, and is different from the one you provided:

    https://github.com/jsleroy/compare-plugin



  • @Alan-Kilborn

    Yes , of course admin :-D

    Never noticed that the homepage listed in the plugin description is the old one. @pnedev - something you want to change??

    EDIT: The about page contains both.



  • @Aliaksandr3by

    This may work for your original query:

    • get the Compare plugin
    • when you want to do this type of preview, first save your file
    • do your replacement operation (Replace All is probably most effective for this “demo”)
    • run Plugins > Compare > Diff since last Save

    This will give you a “preview” of your replacement action.
    If you don’t like what was replaced, simply Undo the replacement.



  • Here’s an example of what such a “preview” could look like:

    Imgur



  • It looks like this POSTING is where I “stole” this idea from. Cred where cred is due.



  • Hi @Ekopalypse ,

    Never noticed that the homepage listed in the plugin description is the old one. @pnedev - something you want to change??

    I started working on Compare as a contributor because I wanted to fix its long-standing instabilities. When I released v2.0 I kept the original plugin project page link - it is the official home of Compare plugin anyway. Sadly, no one maintains it anymore.

    I separated my own clone of the project and started working on a new compare plugin with many new features. It is based on the original Compare but actually differs a lot. I didn’t want to mess the original plugin further but leave its fate to its authors. This way the users could use it as it is now if they prefer it over the new plugin I’m working on.

    So yes, https://github.com/pnedev/compare-plugin is the source of the latest Compare v2.0 because I supported it but Compare plugin’s official project page is still https://github.com/jsleroy/compare-plugin. I am not supporting Compare anymore.
    https://github.com/pnedev/compare-plugin is the home of the new compare plugin I’m working on. It is not released yet.

    Hi @Alan-Kilborn ,

    If you don’t like what was replaced, simply Undo the replacement.

    Unfortunatelly Compare plugin (v2.0 and all prior versions) clears the Undo history due to its internal alignment implementation. Do not rely on Undo after compare with Compare plugin.
    In the steps you mention (if the file is not saved) the user will need to reload the file from disk to get the state before the replacement.

    BR



  • @pnedev said in Can I see a preview for the result of the "replace" form?:

    Unfortunatelly Compare plugin (v2.0 and all prior versions) clears the Undo history due to its internal alignment implementation. Do not rely on Undo after compare with Compare plugin.
    In the steps you mention (if the file is not saved) the user will need to reload the file from disk to get the state before the replacement.

    Ah, I did not know that.
    It makes the technique a little less useful, but it still has value.

    Isn’t there another way for the plugin to do what it needs to without messing with the undo history?

    If you release your version of the plugin, maybe give it a slightly different name to prevent confusion.



  • @Alan-Kilborn said in Can I see a preview for the result of the "replace" form?:

    Isn’t there another way for the plugin to do what it needs to without messing with the undo history?
    If you release your version of the plugin, maybe give it a slightly different name to prevent confusion.

    Unfortunately Compare plugin cannot circumvent the Undo history clean-up.

    The new plugin will be called ComparePlus, it has completely new alignment approach and keeps the Undo intact.
    It is almost finished but sadly that’s its state for about 8 months now. I’m not sure when exactly it will be ready.

    BR


Log in to reply