Announcement

Collapse
No announcement yet.

Automatic "Align with..." - "Force realignment" option

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic "Align with..." - "Force realignment" option

    It is pretty often case when the [almost] only differences are some text blocks (e.g. classes and/or functions) are reordered within same file.

    Let assume there are 2 blocks. Every alignment will show one block aligned, and the other one is in [erased + inserted] diff. In order to ensure there are no diffs in this other block, manual "Align with..." option is required. And this operation is often not convenient, especially when blocks are large and there are many reorders (search is not available).

    Is it possible to have one-click/shortcut "Force realignment" option:
    1) align selected line
    2) regular alignment algorithm on the lines before the selected line from both files and separately on the lines after.

  • #2
    Hello,

    Thanks for the feedback. Ordering is important to the comparison/alignment in the Text Compare.

    The main strategy would be to use a Tidy program to perform sorting. We have an example KB article here:
    http://www.scootersoftware.com/suppo...rnalconversion
    And a few other Tidy/Tidied variants here:
    http://www.scootersoftware.com/downl..._moreformatsv4

    The Align With command can act on multiple lines if you:
    - Select Multiple lines, right-click, Align With
    - Drag select multiple lines as the target

    How does this work for you?
    Aaron P Scooter Software

    Comment


    • #3
      I do not want to sort. Also I do not want to separately sorting rules for C++, C#, Powershell script, Erlang and others we use.

      I just want fast and automatic "Align with...":
      1. Select unaligned line (e.g. first line of moved block), which I'm sure can be aligned.
      2. Press single button (after binding it to the new magic command)
      3. Get files recompared when selected line (and all other lines of moved block) are aligned.

      Comment


      • #4
        Hello,

        Sorry, are you looking for a selection of a single line to weight it more and find "the correct match" on the other side?

        The Alignment Algorithm performs the line by line on load. Selecting a single line, it determined the best match (based on the Session Setting Alignment tab settings) and is already aligned to it. While your eye might see an obvious solution or better match, for the program to recognize a better match you would need to update the Session Settings -> Alignment Tab settings.

        I suggested the sorting methods because I assumed your lines were in a different order, so pushing one line down with an Align With pushes all lines below it further down; order is always important, and sorting is the only solution if paragraphs or methods need to be moved above or below other methods.

        Also, selecting multiple lines (shift select) to Align With a block instead of a single line forces all of the lines to re-compare within just the selection. When performing on a single line, similar to the On Load, the following lines may 'appear' to be better matches, but the current Alignment algorithm is finding a better match with the displayed pair.

        Are your blocks of text out of order and have you tried Patience Diff as an alternate alignment method? Ideally, by tweaking the settings, manual alignment of entire blocks is less necessary, with the exception of if entire blocks are out of order. If you would like, you can email in example files and your BCSupport.zip to support@scootersoftware.com and I can get a better look at your current comparison. If you can also include a full screen screenshot of a problem line and a link back to this forum thread, I'll be able to reconstruct your current comparison and review it.
        Aaron P Scooter Software

        Comment


        • #5
          Sorry, are you looking for a selection of a single line to weight it more and find "the correct match" on the other side?
          Exactly. I have manual "Align with..." and I want automatic "Align with...". With the only difference between them is automatic searching for the matching line (by giving it some very big weight) instead of manual selecting matching line.

          Comment


          • #6
            You can add a Line Weight in the File Format, Grammar tab, as a global setting for that file type. This weight is not absolute, and integrates into the algorithm. Have you customized the Text Compare's Session Settings, Alignment tab?
            Aaron P Scooter Software

            Comment


            • #7
              Well,

              This is the use case:

              Every day I need to compare 50 files, 10000 lines each with previous version, when most (but not all) changes in each file are reordering multiple blocks.
              Every day there are different 50 files, with different changes and there is no any pattern on the first line of the reordered blocks.

              Currently I use "Align with..." - and for each unmatched block I need to search for matching line (select, copy, paste in search...), remember it, choose "Align with...", scroll the buffer to the remembered line and click on it. This is very annoying and I can't see how Session settings can help, when there is no any pattern on the lines I want to match.


              I just want it AUTOMATIC!!! ))))

              I select the line, press SINGLE KEY and magic command AUTOMATICALLY changes Session settings, giving the selected line very large weight (also, removing weight from previous call) and recompares the buffers.

              That's it. And I KNOW how to achieve the result, but currently it is very far from SINGLE KEY press, and I need this operation hundreds of times every day.

              Comment

              Working...
              X