No announcement yet.

How to prevent alignment on a single matching character?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to prevent alignment on a single matching character?

    How to prevent alignment on a single matching character?

    I see that people already complained that BC picks some random characters from a line, matches them to some characters from another line and declares the lines aligned.
    As the result line:
    - (id)retain
    aligns with
    void removeThisRequestAsync()
    simply because both of them have letters 'r', 'e' and 'n'!
    This is so wrong!
    Then the rest of the file is aligned incorrectly.
    Actually the first file has line "removeThisRequestAsync" few pages below,
    but that 3 character match prevented BC to search further.

    How can I prevent it?
    I tried all settings under Session -> Alignment,
    but they are only for lines, not for characters.
    I would like to specify that lines should be only matched if they have an identical word
    or if certain number of contiguous characters match,
    but I could not imagine in which case matching randomly picked non-contiguous characters would make sense.

    Currently I am trying to modify my files to reduce the number of equal characters.
    I cannot rename "retain" since it is a keyword.
    I tried to replace "removeThisRequestAsync" by "deleteThisRequestAsync",
    but BC again matches it with "retain" because both have letters 'e', 't' and 'n'!
    Then I replaced "removeThisRequestAsync" by "removeThisRequest"
    Still, BC matches it to "retain" simply because they have a single character 'r'!
    But this way you can match any text to any other!
    Does not make any sense.
    I understand when '{' matches '{' because it is a stand alone token,
    but matching a single character within a word in Java code seems to be a bug.

    Note: I cannot use Session -> "Never Align Differences" option
    because I need to align when entire words match, for example:
    self.somePropertyName = 1;
    should align with
    somePropertyName = 1;

    Thank you

  • #2

    The alignment algorithm you are looking for is line based, not character based. The same logic that allows self.somePropertyName to align with somePropertyName, is also finding the closest match with these other two lines, and then lining it up.

    If you have a pair of example files you can email in to [email protected], please also include:
    - A link to this forum thread for our reference
    - Your from the Help menu -> Support; Export
    With these and your example files, we can re-create your comparison in office and see if we can provide you with a couple tweaks or tips to see a better alignment.

    If you would like to try tweaking the alignment on your own, I would recommend increasing the Skew Tolerance first; if the Skew is not large enough to find the exact match "a couple pages down", then it would align on the closest it can find. You can manually type a number here, so please try a max/high value.

    You can also try Alternate Alignment, to see if that aligns closer as you expect for your files.
    Aaron P Scooter Software