Compare plugin is back!



  • Hello all,

    It’s been a year since I started working on fixing Compare plugin’s stability issues but because I like it a lot I got way further and did a serious code rework/refactoring and made many improvements/fixes. Now finally I’m pleased to announce the new ComparePlugin version 2.0.0.

    First I’d like to thank several people:

    • all Compare plugin developers up to now:
      – its original author, Ty Landercasper for his great idea and the creation of the plugin
      – its official maintainer, Jean-Sebastien Leroy for his work and for adding me as plugin contributor
      ufo (@ufo) for his plugin improvements and for adding the initial versions of Git Diff and SVN Diff commands
    • Yaron (@Yaron) who actually involved me initially in Compare plugin’s improvement for all his commitment to making it a piece of art, for his countless suggestions, for all the discussions (we’ve had several tough ones :)), issue reports and testing and for supplying all the plugins’ icons. I would say that he’s been a Compare plugin’s QA throughout the whole development process.
    • Waldi Ravens (@xylographe) for the discussions, suggestions and issue reports, for the VS2015 project addition and the help with UTF-8
    • Christian Grasser (@chcg) for making the 64-bit compatibility changes, adding the README and the AppVeyor and Travis automatic build and deployment configs and helping with Git library issues.

    Here are the Compare plugin v2.0.0 release notes:

    • Major Compare plugin re-work, big portions of the code are re-written.
    • Fix crashes and unstable behavior.
    • Fix memory leaks.
    • Improved compare algorithm in both accuracy and speed.
    • Reduced memory usage.
    • Support for unlimited active compares.
    • ‘Set First’ command added to select the first file to compare (that removes the need to manually move one of the files to the other view before comparing).
    • Better N++ notifications handling - closing or moving compared files is handled appropriately and doesn’t lead to weird/unexpected results.
    • Proper file positions restoring after closing the compare.
    • Greatly improved Navigation bar.
    • Improved Compare progress behavior - it now accurately represents the compare process.
    • Improved settings dialog - the plugin behavior / results presentation is more customizable now.
    • Better results synchronization in case of wrap around active setting and in general.
    • Added compare toolbar icons (thanks to Yaron).
    • Better compare results line margin symbols (thanks to Yaron).
    • Better default diff colors (thanks to Yaron).
    • Updated for 64-bit build (thanks to Christian Grasser - chcg).
    • Added VS2015 project (thanks to Waldi Ravens - xylographe).
    • Numerous bug fixes and improvements.

    You can find the x86 variant of the plugin through the Plugin Manager (when its list gets updated) and both x86 and x64 variants from https://github.com/pnedev/compare-plugin/releases/tag/v2.0.0.

    The official Compare plugin project is still https://github.com/jsleroy/compare-plugin but I had problems making automatic AppVeyor deployment there, that’s why the release is on my project’s clone.

    If you’d like to do it, you can donate here.

    Enjoy!



  • Hello,

    Most Notepad++ users would find a text-comparing tool available within the editor quite useful.

    Over the last year Pavel Nedev has been painstakingly fixing tens of bugs, meticulously addressing numerous issues and most cleverly optimizing and polishing Compare Plugin.
    The result - Compare Plugin v2 - is a true masterpiece.
    Users who Compare frequently would surely understand, appreciate and agree.

    The work Pavel has undertaken and accomplished is enormous.
    A task of such a scale would normally require a full team of talented developers.
    This has been a one-man-show; a brilliant performer and an excellent show.
    Thank you. I am grateful.

    Now, Pavel, it’s time to move on.
    Microsoft? Mozilla? - We want better OS and Browsers. :)

    I wish you the very best wherever you go and whatever you do.



  • Nice news to know! It’s time to update my compare plug-in.
    Talking about where to move on, personally, I wish there were a better shortcut mapper, that, when I press a hot key combination, it tells me what it is already mapped to.
    Or maybe the regex engine?
    Because @guy038, the regex master, said in this page:

    Of course, I long for, ( since more than 3 years ! ), that this version would be fully integrated with, both, the latest version of N++ and Scintilla. Unfortunately, up to now, NO ONE feels interesting to implement the new regex François-R Boyer’s code



  • @pnedev ,
    Used this plug-in a long time.
    Tried the new one. big like. thanks.



  • Thx, now this plugin is realy easy and convenient to use.



  • When installing the ComparePlugin.dll on a Win7 x64 machine, I receive an error that, “It has not been possible to
    validate the integrity of dll”.

    Image of error

    Is this a known issue?

    Thanks for your support (and the plugin development)



  • @Grady-Cooper

    this means that the version you download has a different checksum compared
    to the one plugin manager knows. This happens when plugin developer has a new
    version of the plugin but plugin manager hasn’t yet received/loaded the new checksum.

    Cheers
    Claudia



  • Hello Claudia and Grady,

    @Claudia,

    Thanks for the explanation.

    @Grady,

    The bottom line of Claudia’s reply is that Compare Plugin v2 is absolutely safe (and great! :) ).
    Thank you Pavel Nedev.

    Best regards.



  • Thanks @Claudia-Frank and @Yaron .

    @Grady-Cooper ,
    AFAIK at the moment you cannot use the N++ Plugin Manager to download 64-bit plugins.
    If you need the 64-bit Compare plugin version please get it from here: https://github.com/pnedev/compare-plugin/releases/download/v2.0.0/ComparePlugin_v2.0.0_X64.zip.
    Copy the archive contents to your N++ install path -> plugins sub-folder.

    BR



  • I’m getting the same issue as @Grady-Cooper. This is running 32-bit Notepad++ on Windows 10. Although there are workarounds, is there any chance that the checksum can get updated so that the Plugin Manager can let it through?

    Still, thanks for your efforts. :)



  • I did the required changes, hopefully the Plugin Manager list will get updated soon.
    BR



  • Thanks for your efforts!

    FYI the Plugin Manager list is apparently updated once every two weeks–I just checked and the next update is luckily scheduled in just 3 hours from now (at 20:00 UTC).



  • Dl links on GitHub appear to be dead. Anyone else having issues?



  • What exactly do you mean? Can you post the link you are trying to access here?



  • Hi and … OMG is it a way to get the older version back?

    I loved this plugin cause i work on a script exist in 2 versions, with only UI differences and it’s really usefull to modify fast the few differences.

    Anyway, since the new version, an update from a few days ago, this plugin is simply butchering my code, putting spaces and new lines everywere, making the whole thing after one or two update impossible to see what you are doing.

    I really prefered the old one, much more clearer and not messing with my file. Lost a day in developpement simply fighteing with the plugin and restoring what it messed to normal.



  • Hello @Shalassan ,

    You can get the old version from https://sourceforge.net/projects/npp-compare/files/1.5.6.2/ComparePlugin.v1.5.6.2.bin.zip/download.
    Replace the ComparePlugin.dll in your Notepad++ install folder plugins subfolder with the one from the zip archive.

    FYI: The empty spaces and lines that the new version inserts are for diffs alignment purposes. Those are not put in your file permanently - when you save the file the inserted blanks are not included and when you close the compare your file is cleared from all alignment spaces inserted. Sorry for the inconvenience.

    BR



  • @pnedev

    Have you thought about using annotations to simulate blank lines? That way blank lines aren’t needed but you can still space out lines so that they match up.



  • Hello,

    @Shalassan,

    @pnedev has fixed tens of bugs and introduced many great new features in v2.
    CP users should be very grateful for his amazing work.

    If I understand you correctly, you were using the old version with the option “Align Matches” unchecked.
    By default, this option is checked and blank lines are inserted in the old version as well.

    You can politely request help as to using the excellent new version.

    @dail and @DaveyD,
    Greetings. :)



  • Hi @dail ,

    I didn’t imagine the annotations could help with aligning. It’s worth trying, thanks for pointing that out.

    BR



    • I need to find a way to get a file compare to read lines on a line by line basis within individual sections cause i work with files from different people that change settings for games i play for user added content. When i use compare as it is setup by default i get miss read information as it dose not notice if lines are simply in a different order in the new file. I need it to compare different lines of only the one section because the same command could be in a different section or even a similar command within the same or another section. The new file may even add whole new sections.

    File 1 File 2

    [Section 1 Name] [Section 1 Name]
    Command 1 command 3
    command 2 command 1
    command 3 command 2
    command 4 command 4
    Command 5 command 6
    command 6 command 5

    [Section 2 Name] [Different Section 2 Name as new file adds a new section]

    [Section 3 Name} [File 1 Section 2 Name]

    In the current setup of compare commands 1-3 will have a - in file 2 and commands 3,1,2 will have a + in file 2 even though they are the same commands in a different order and commands 5 file 1-2 will either show blue arrows showing same command different lines or command 6 file 1 and command 5 file 2 will show the symbol for the commands are similar but slightly different. I am not sure why these two different actions happen with commands 5-6. I have uploaded the files to dropbox in case i did a poor job relaying what i am trying to say.

    File 1: https://www.dropbox.com/s/40i2s7nz42b9p4h/File 1 input.settings?dl=0
    File 2: https://www.dropbox.com/s/xeyr3212xw4igsx/File 2 input.settings?dl=0

    These files have no personal information just game settings. Any help would be great maybe compare has settings i can change to fix this that i don’t know about or something?



  • Hello, @john-powers,

    I think that I succeeded to find a way to easily see the differences between your two files, that I downloaded, yesterday …, if you don’t mind that sections and lines, inside sections, are sorted out :-D

    Let me explain the general idea :

    Assuming the original text :

    [Section XYZ]
    lllll
    wwwww
    aaaaa
    fffff
    
    [Section ABC]
    lllll
    bbbbb
    wwwww
    

    I thought, with the help of some regular expressions, to transform this text, in such a way :

    [Section XYZ]lllll
    [Section XYZ]wwwww
    [Section XYZ]aaaaa
    [Section XYZ]fffff
    [Section ABC]lllll
    [Section ABC]bbbbb
    [Section ABC]wwwww
    

    Then, using the usual lexicographically sort, it would ends to :

    [Section ABC]bbbbb
    [Section ABC]lllll
    [Section ABC]wwwww
    [Section XYZ]aaaaa
    [Section XYZ]fffff
    [Section XYZ]lllll
    [Section XYZ]wwwww
    

    Once this way done, for your two files, the compare results are just fine to study !!


    As I supposed you’re eager to see if my method could be of interest for you, I will, simply, give you the different regex S/R to run, without any explanation, for the first time. Afterwards, if you need it, I’ll able to develop these regexes !

    I, simply, renamed your files, as File_1.txt and File_2.txt. All the process, below, has to be executed for your TWO files ! So :

    • Open the File_1.txt file in Notepad++

    • Move back at to its very begining, if necessary ( Ctrl + Home)

    • Open the Replace dialog ( Ctrl + H )

    • Untick any option

    • Select the Regular expression search mode ( IMPORTANT )

    Remarks :

    • Throughout all the process, the cursor position will never change ( at beginning of line 1 )

    • It would better to copy/paste the different regexes from your browser to the Replace dialog zones, instead of typing in, manually !


    FIRSTLY, we delete extra blank lines, but an unique line spacing ( for the good execution of the following regexes ! ) :

    • Type (\R\R)\R+, in the Find what: zone

    • Type \1, in the Replace with: zone

    • Click on the Replace All button, exclusively

    => In your case, with your files, you should get the Replace All:O occurrences were replaced message. However, it’s best to run this S/R, in all cases, in order to clean up the contents !


    I noticed, that, sometimes, you have sections, with no element at all ( as, for instance, [death], [EMPTY CONTEXT],… ). I preferred to add the single element NONE, right under its section’s name. So :

    SECONDLY, we add the dummy single element NONE, to each orphan section :

    • Type (?-s)^[.+?]\R(?=\R), in the Find what: zone

    • Type $0NONE\r\n, in the Replace with: zone

    • Click on the Replace All button, exclusively

    In your case, you should obtain 4 replacements !


    Now, for the good execution of the fourth and last regex S/R, we’re going to swap, the name and contents of each section. That is to say that, from the text :

    [section AAA]
    11111
    22222
    33333
    
    [section BBB]
    

    we want to obtain :

    11111
    22222
    33333
    [section AAA]
    
    [section BBB]
    

    =>

    THIRDLY, we move each section’s name, downwards, AFTER its block of elements :

    • Type (?-s)^([.+\R)(?s)(.+?\R)(?=\R?[|\Z), in the Find what: zone

    • Type \2\1, in the Replace with: zone

    • Click on the Replace All button, exclusively


    Finally, we add, in front of any element of any section, its section’s name and we delete any individual section’s name, located at the end of each block. That is to say that, from the text :

    11111
    22222
    33333
    [section AAA]
    

    we want to obtain :

    [section AAA]11111
    [section AAA]22222
    [section AAA]33333
    

    =>

    FOURTHLY, we add the appropriate section’s name, at beginning of each element and we delete the individual section’s name lines :

    • Type (?-s)^[^\r\n[].+(?=(?s:.+?)\R([.+?]))|^[.+?]\R+, in the Find what: zone

    • Type (?1\1$0), in the Replace with: zone

    • Click on the Replace All button, exclusively

    • Save this version, as File_3.txt

    • Execute the menu choice Edit > Line Operations > Sort Lines Lexicographically Ascending

    • Save this sorted version, as File_5.txt


    Then, follow the same steps as above, with your second file File_2.txt

    • After the four regex S/R, save that version, as File_4.txt

    • Execute the menu choice Edit > Line Operations > Sort Lines Lexicographically Ascending

    • Save this sorted version, as File_6.txt


    Finally, run the Plugins > Compare > Compare command, on File_5.txt and File_6.txt files. Do you like it ?!

    Just try to compare File_3.txt and File_4.txt files, BEFORE sorting, it’s quite tedious, isn’t it ? :-D And, even if you uncheck the option Plugins > Compare > Detect Moves, it’s still be complicated to analyse, isn’t it ?

    Anyway, I hope, that I correctly interpreted your needs !

    Best Regards,

    guy038

    PS : Of course, I’m using the excellent Compare plugin, last version v2.0.0, of Pavel Nedev ( alias @pnedev )

    I forgot to give some statistics about your two files :

    Concerning the File_5.txt file :

    • 43 sections, containing 2416 elements

    • 4 orphan sections, with 4 NONE elements

    => A total of 47 sections, for 2420 elements

    • 13 minus sign red bookmarks, after the compare process

    Concerning the File_6.txt file :

    • 42 sections, containing 2486 elements

    • 4 orphan sections, with 4 NONE elements

    => A total of 46 sections, for 2490 elements

    • 83 plus sign green bookmarks, after the compare process

    And the differences are :

    • The section [BASE_CameraMovement] absent in File_6.txt

    • 70 elements, added in File_6.txt ( 2490 - 2420 ), which is, exactly, the difference between the bookmarked lines ( 83 - 13 ) !


Log in to reply