Community
    • Login

    Compare plugin developement

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    13 Posts 6 Posters 5.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Scott SumnerS
      Scott Sumner @Mehreen C
      last edited by

      @Mehreen-C

      Suggestion: Try the 2.0 version of the Compare plugin. Not sure if it will meet all your needs, but I think it is definitely worth taking a look at before doing anything else.

      1 Reply Last reply Reply Quote 1
      • YaronY
        Yaron
        last edited by

        @Mehreen-C,

        Pavel Nedev has done the hard work.
        https://github.com/pnedev/compare-plugin/releases

        @Scott-Sumner,

        Not sure if it will meet all your needs

        It sure will. :)

        1 Reply Last reply Reply Quote 1
        • Mehreen CM
          Mehreen C
          last edited by

          version2 compares in the same manner. it works files for actual text documents with spaces. but does not highlight the any change in a string (got pictures to illustrate but donno how to post then!).

          I’m trying to compare tow .hex files. the link I posted compares the files and highlights WHERE the changes occurred. using the plugin all i get as output is what a line as added/removed… not very useful if you have a long string of numbers to look at!

          Scott SumnerS 1 Reply Last reply Reply Quote 1
          • Scott SumnerS
            Scott Sumner @Mehreen C
            last edited by

            @Mehreen-C

            got pictures to illustrate but donno how to post then!

            To post images here, use your favorite image hosting site (mine is imgur) but YMMV, and post your image files to it. It will give you a link, that looks like this one:

            http://i.imgur.com/QTHZysa.png

            Wrap that with some sugar so that it appears like this in the “COMPOSE” pane on this site:

            ![ ](http://i.imgur.com/QTHZysa.png)
            

            In the “PREVIEW” pane you should see your image rendered–if you don’t you did something wrong. Here’s how the link above renders when the posting is submitted (see! it’s an embedded image!):

            Mikhail VM 1 Reply Last reply Reply Quote 0
            • Mikhail VM
              Mikhail V @Scott Sumner
              last edited by

              @Scott-Sumner said:

              @Mehreen-C

              got pictures to illustrate but donno how to post then!

              To post images here, use your favorite image hosting site (mine is imgur) but YMMV, and post your image files to it. It will give you a link, that looks like this one:

              http://i.imgur.com/QTHZysa.png

              Wrap that with some sugar so that it appears like this in the “COMPOSE” pane on this site:

              ![ ](http://i.imgur.com/QTHZysa.png)
              

              OT: Scott, (I ask here as I did not want to start a new topic).
              Can we have a FAQ section about how to e.g.:

              • post images
              • how to make a code block so as to avoid it appear with a horrible black background (I could not yet but I see you can do it somehow)
              Scott SumnerS 1 Reply Last reply Reply Quote 1
              • Scott SumnerS
                Scott Sumner
                last edited by Scott Sumner

                @Mikhail-V

                Can we have a FAQ section…

                @PeterJones explains this at the bottom of this FAQ but “markdown” probably deserves its own FAQ Desk entry, perhaps a cleaned-up and enhanced version of this old posting…hey, there’s that woman’s picture again!

                1 Reply Last reply Reply Quote 1
                • Scott SumnerS
                  Scott Sumner @Mikhail V
                  last edited by

                  @Mikhail-V

                  And by the way, here’s my code-block secret for the short term (composed in Notepad++ and screen-captured) until a better FAQ Desk entry is made:

                  Imgur

                  Those are backticks or grave accent (U+0060) characters on the first and last lines, in case that is not clear–probably isn’t clear as they look kind of lame in the Consolas font…

                  The above will render as:

                  parents, babies = (1, 1)
                  while babies < 100:
                      print 'This generation has {0} babies'.format(babies)
                      parents, babies = (babies, parents + babies)
                  
                  1 Reply Last reply Reply Quote 1
                  • PeterJonesP
                    PeterJones
                    last edited by PeterJones

                    @Mehreen-C ,

                    Back to the topic: as others have said, a screenshot can be quite helpful – and while cleaning out my temporary screenshot directory, I saw I had this animated screenshot (apparently from some other Compare-plugin question, though the pic hadn’t been previously posted to imgur) – it reminded me of your post, and once I confirmed you didn’t have a solution here yet, I uploaded the pic and started thinking more about your problem:

                    Source files:

                    #!/usr/bin/perl
                    if(a) {
                        print "something\n";
                    } else {
                        print "something else a\n";
                    }
                    

                    and

                    #!/usr/bin/perl
                    if(b) {
                        print "something\n";
                    } else {
                        print "something else b\n";
                    }
                    

                    (embedded text by indenting four spaces. You can also use Scott’s " ```z " … trick (above))

                    As you can see, when I turn on the Compare feature, it highlights that the “a” vs “b” is different on lines 2 and 5. You can use my example text to prove whether your setup works under any conditions: it should look similar to my screenshot.

                    So v2.0 Compare Plugin can show specifically what’s different on two lines.

                    And when I give it a list of numbers in the two windows,

                    3.1415926 2.718281828 
                    
                    3.2830926 2.718281828 
                    

                    … it highlights that I mistyped π in the second file:

                    So, the plugin can show the difference between numbers as well.

                    If you are having problems with specific data, please include that data: embed the text, so we can easily copy/paste; and embed an image, so that we can see that it doesn’t highlight properly on your setup. (A full screenshot of the window can give us extra clues, too: for example, my screenshot shows “Normal text file”, so we know it’s just using the default/plain lexer, and not some other lexer or UDL.)

                    In fact, if you do have a Language or UDL selection, that’s something important to let us know, because it can influence things – maybe the Compare Plugin and Lexer/UDL highlighting are fighting each other… If a Lexer or UDL are active, you might want to temporarily manually choose Language > Normal Text on both panes, before doing the compare. If that solves your problem, then it probably is a fight between the two.

                    1 Reply Last reply Reply Quote 3
                    • YaronY
                      Yaron
                      last edited by

                      @PeterJones,

                      An excellent detailed reply.

                      In fact, if you do have a Language or UDL selection, that’s something important to let us know, because it can influence things – maybe the Compare Plugin and Lexer/UDL highlighting are fighting each other…

                      I haven’t encountered such a problem. :)

                      1 Reply Last reply Reply Quote 0
                      • pnedevP
                        pnedev
                        last edited by

                        Hello all,

                        I suppose what @Mehreen-C is saying is that if you compare text files that are sequences of hex number lines (without any delimiters between the numbers) the Compare plugin won’t show you the exact mismatching hex digits between the lines.

                        Here are two files illustrating the issue:

                        file1
                        0123456789ABCDEF
                        FEDCBA9876543210

                        file2
                        A123456789ABCDEF
                        1EDCBA9876543210

                        Unfortunately that’s how CP is working at the moment - it compares the words between the lines (instead of the characters) and since hex digit sequences are not ‘words’ (they are considered as a single word) the whole lines are marked as different. If there were some delimiters between the digits (so that there were several groups of digits (words) ) we would have gotten a mark exactly in which group the diff is.

                        For instance:

                        file1
                        01 23 45 67 89 AB CD EF
                        FE DC BA 98 76 54 32 10

                        file2
                        A1 23 45 67 89 AB CD EF
                        1E DC BA 98 76 54 32 10

                        I’ll consider changing that behavior so the lines diffs are marked character-wise but can’t promise anything.

                        BR

                        1 Reply Last reply Reply Quote 3
                        • pnedevP
                          pnedev
                          last edited by

                          Hello @Mehreen-C ,

                          Here is a VERY crude and sub-optimal quick fix (patched v2 plugin, x86 DLL).
                          Note however that CP v2 has some issues with hex text comparing (sometimes falsely reports lines as matching). For further info about this problem please check this topic.

                          BR

                          1 Reply Last reply Reply Quote 2
                          • YaronY
                            Yaron
                            last edited by

                            Hello Pavel,

                            :+1: for understanding the OP. :)
                            And thank you for the quick fix.

                            BR

                            1 Reply Last reply Reply Quote 1
                            • First post
                              Last post
                            The Community of users of the Notepad++ text editor.
                            Powered by NodeBB | Contributors