Compare plugin is back!



  • 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 ) !



  • @John-Powers have you considered using a separate tool? When I need to merge to “ini” type files I use the file compare feature in “total commander”. I can edit side by side in file compare feature, see the differences and manually copy and paste differences . You can download total commander and try it.



  • I downloaded https://github.com/pnedev/compare-plugin/releases/tag/v2.0.0. and used.
    After installing this plug in my notepad++ became unstable and starting behaving weirdly. I have uninstalled the plug-in as well as notepad++. Will re-install notepad++ alone and check.



  • @Pawan-Kumar

    I never noticed that the Compare plugin caused Notepad++ to be unstable. But there are some other plugins doing so, e.g. MenuSearch and LocationNavigate. Especially MenuSearch is weird because wether it causes problems depends on the presence and/or absence of other plugins. At my site it works fine if NppFTP is installed as well.

    You should try to install one plugin after another and perform tests after every installation until you find a plugin which causes problems. Then uninstall all other plugins and test the suspicious one alone. If it works fine start adding other plugins until you are facing problems again. Then remove all plugins except the first and the second suspicious one and repeat the sequence.

    This way you will find combinations of plugins which effect each other in ways that make Notepad++ become unstable.


Log in to reply