No announcement yet.

Can compare 2 different sections of the same document ?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Can compare 2 different sections of the same document ?


    I wonder if it'd be possible to compare 2 different parts of the same document, like 2 paragraphs in text files or 2 procedures in a source which basically are similar but somewhat different, find the differences and perform some alignment.



  • #2

    There are a couple ways to do this:

    1) Open the document on both sides of the Text Compare and use the Align With command in the right-click menu.

    2) Select the text paragraph in the document and Copy it (to clipboard, as if preparing to Paste it). Select the 2nd paragraph, rigth click, and select "Compare to Clipboard". This will launch a new tab comparing the clipboard (paragraph 1) to the selected text (paragraph 2).

    How do these methods work for you?
    Aaron P Scooter Software


    • #3
      Thanks for the quick answer.
      Aligning was the first thing I tried but doesn't work in my case.
      The reason is probably that the 2 parts I want to compare are 2 Visual Basic Subs, let's call them SubA & SubB.
      The subs in the source are one after the other and about 100 lines long
      Immediately after the declaration there one line of code (a message) different between subA and subB
      After there are some common lines.
      What happens is that if I align subA with SubB i get the 2 declarations aligned, a big empty space under subA and the messages of subB and subsequent code aligned again. I tried also the alternate method with the same results. Probably I should play more with alignment parameters, but if possible I don't want to mess with them since they work well as they are.

      The clipboard comparation worked

      Thanks again



      • #4
        In the Text Compare of BC3, you can also highlight a section of text (paragraph/whole function) and align with another section (paragraph/function), instead of just two lines. Does that better align your subA and subB?
        Aaron P Scooter Software


        • #5
          I tried but couldn't figure out how to select 2 different sections and compare them.
          Whenever I select one section and go to the other window to select the other the 1st selection is reset.
          When I compare a selection with the clipboard I see that another session is opened between something like "Section at hh:mm:ss" and "Clipboard at hh:mm:ss", so I suppose there must be a way to get Section1 <-> Section2.
          Btw, the modifications made in the new session are saved in different files than the original.

          For now the best way I've found is to do a selection vs clipboard comparation, perform the changes I need, and eventually copy and paste the modified clipboard/selection contents in the original document.
          It's a little clumsy but works and saves me a lot of time.

          It'd be nice, in my opinion, to be able to select in the 2 windows the 2 sections to compare by selecting their start/end lines and also to save the changes made in the original file.

          Another nice feature would be the possibility to collapse parts of the document(s)

          Simply suggestions, BC is already great!!!



          • #6

            Yes, the Compare to Clipboard will open a new tab not related to the original files. This would only work well for comparison and not editing.

            How does selecting multiple lines and Align With work? A more detailed walkthrough:
            Select multiple lines (an entire function).
            Right click and Select Align With
            Left click and hold, then drag over the other paragraph. This is easiest if you start at the top and click/drag to the end of the function.
            Aaron P Scooter Software


            • #7
              OK !!!
              I got what I needed Thank you
              The only "problem" I have is that, being the 2 subs quite long, it's a little difficult to click/drag, having to scroll across some pages. But when done they are correctly aligned with the differences properly highlighted. Great!!

              Again, if you could report my 2 little suggestions (especially start/end text) in the wish list I'd be very grateful.

              Thank you again for the help



              • #8

                Thanks for the suggestions. I talked with one of our developers and had a few additional pointers that may help.

                After you select the text on the left, and select Align With, instead of Left clicking and dragging, use the Alt+Arrow keys to move the cursor to the other side. You can then use the Up and Down arrows to find the beginning of the selection, or the PgUp and PgDwn keyboard commands. Once selected over the start, you can select the large function with a combination of Shift+PgDwn or Shift+DownArrow. After it is selected, hit F7 (the Align With default shortcut) or right click on the selection and pick "Align with marked".

                Does this help with your selection of a larger area?
                Aaron P Scooter Software


                • #9
                  Oh yes, it's much easier this way, thank you.

                  Another couple of things still on comparing different sections of the same file

                  It can happen during such compares that one sometimes copies lines from left to right panels or from right to left.
                  Now, if let's say right save button is pressed a popup appears saying something like "Left file changed on disk, reloading will discard all changes". So right changes will be saved and left ones lost. The opposite if left save is pressed.
                  In my opinion when left and right panels refer to the same file all the changes should be saved regardless which save button is pressed.

                  After a save/reload all the alignments are lost and one has to start the selections again. It'd be nice if a "Save preserving alignment" option was available.


                  • #10

                    That message would only come up if you had made edits to both sides. When saving the left side, we would only save the changes made on the left side to the file (and must discard the edits made on the right). If you can, please make edits to only one side, or be absolutely sure you've brought over all edits you need to the side you are saving.
                    Aaron P Scooter Software