When Merge compares text content, it first identifies distinct blocks of unchanged, changed, inserted, and removed text. The settings on this page relate only to blocks of changed text thus identified. They determine how potentially corresponding lines in those change-blocks are matched into pairs (thus affecting whether particular lines within a change-block are highlighted as changed, inserted, or removed), and also how any text differences within individual lines are highlighted. Line pairing also affects how blocks of changed text are further decomposed, should the Intelligently split blocks of changed text based on matched line pairs preference be checked.
These preferences do not affect whether or not Merge will identify specific differences between compared files. However, they can radically affect how detected changes are presented.
Inline change highlighting and change-block decomposition
Show detailed (rather than simple) inline changes within paired lines
When checked, Merge performs a detailed comparison of the text within pairs of changed lines, highlighting every inserted, removed, or changed character or word (depending upon the setting of the Compare and highlight lines based on words (rather than characters) preference). Characters and words are highlighted using the colours specified in the Fonts/Colours preferences page. Depending on the content of files being compared, enabling this preference can make file comparisons slower.
When unchecked, Merge performs simple inline-comparisons on pairs of changed lines. Text from the first changed character within a line to the last changed character is highlighted using the changed style. This preference reduces visual clutter in comparisons where many visually dissimilar lines have been paired. It can thus be particularly helpful in some situations where line-pairing rules are enabled. Using this preference can also provide better performance at the expense of producing less-detailed inline highlighting.
This checkbox corresponds to the Show simplified inline changes and Show detailed inline changes radio buttons on the Display preferences page in older versions of Merge.
Compare and highlight lines based on words (rather than characters)
When checked, Merge will perform a word-by-word comparison between lines, highlighting any differences accordingly. This generally produces less visual clutter than the character-level comparison and highlighting that is performed when this preference is unchecked.
This preference affects both the highlighting of changes within lines and how lines are paired. (Line-pairing will not usually be greatly altered by this preference, but the difference in comparison granularity can sometimes affect the results.)
Intelligently split blocks of changed text based on matched line pairs
When checked, Merge will endeavour to split multiline blocks of changed text into smaller blocks of inserted, removed, and changed text. This splitting is performed intelligently, based on any corresponding pairs of lines that Merge is able to match within the original block of changed text.
When unchecked (the default), Merge will not split blocks of changed text.
Note that the decomposition of blocks of changed text (which is likely to occur when this preference is checked) results in adjacent insertions, removals and changes being shown in the comparison display. This can be very useful in understanding precisely how the compared files are related, and it can also make it easier to propagate individual changes from one file to another. Nevertheless, the presence of additional, adjacent linking lines in the text comparison display can at first seem unfamiliar. The resulting increase in the number of individual changes, insertions, and/or removals can also add an unnecessary degree of complexity in some straightforward comparison scenarios. You may therefore wish to experiment with this setting, seeing how it works with a variety of different files.
This checkbox replaces the Break change blocks into individual lines preference on the Display preferences page in older versions of Merge.
Match pairs of lines within each block of changed text
Merge offers several approaches for matching pairs of corresponding lines in blocks of changed text. (See the introduction at the top of this page for how line-pairing affects the display of comparison results.)
The default setting, Intelligently (based on the contents of the lines), is almost always recommended, but certain scenarios (particularly with data-containing files) may benefit from other choices.
Intelligently (based on the contents of the lines)
When selected, Merge will examine the contents of each line in both sides of a block of changed text, using heuristics and any active line-pairing rules to find related pairs of lines.
Consecutively (working downwards from the top of the block)
When selected, Merge will pair the top line of the left side of the change-block with the top line of the right side, the second line of the left side with the second line of the right side, the third with the third, and so on, down to the bottom of the change block. If one side of the change-block contains more lines than the other, the additional lines will remain unpaired and will therefore be highlighted as having been inserted or removed.
Line-pairing rules are not used when this preference is chosen, since consecutively pairing lines takes no account of the line content.
Adaptively (consecutively, when both sides of the block have an equal number of lines, otherwise intelligently)
When selected, Merge choses between the Consecutively and Intelligently line-pairing strategies, depending on whether both sides of a change-block contain the same number of lines. The Consecutively strategy is used only for change-blocks where both sides have an equal number of lines; the Intelligently strategy is used otherwise.
Advanced Line-Pairing Options…
This button opens the Advanced Line-Pairing Preferences dialog.
Line-pairing rules checked below define the parts of a line to consider when matching pairs of lines
Merge considers any checked line-pairing rules in this list when trying to match corresponding lines. (See the introduction at the top of this page for how line-pairing affects the display of comparison results.)
Double-click a line-pairing rule to edit its definition, or use the buttons to create or remove rules.
Line-pairing rules enable Merge to pair corresponding lines in a block of changed text based on particular portions of a line matched by a given regular expression.
By default, when no line-pairing rules are active, Merge considers the entire text of each line when it tries to match and pair corresponding lines within a block of changed text. This strategy works well for a wide variety of files, but the display of comparison results can be drastically improved for some types of files by creating and enabling line-pairing rules, so that only a portion of certain lines is considered.
One common use for line-pairing rules is to pair lines within localization files. These files generally consist of many lines, each containing a unique resource identifier and some associated localized text. Thus, for example, when comparing an English version of a file with a Japanese localization, almost no lines would be paired appropriately if the entire text of each line were to be considered. This is because most of the text of each line is language-specific, and thus unique to a particular localization. An appropriate line-pairing rule, however, would consider only the resource identifiers of each line, thus typically enabling excellent results for such comparisons (provided that both files have the localized resources in the same order).
There are many other uses for line-pairing rules. For example, when comparing Windows resource (
.rc) files, it makes sense to try to pair lines that contain definitions for matching resource identifiers, even if the lines are otherwise very different. Likewise, C/C++
#define directives should generally be matched if they define the same identifier, regardless of the content of the rest of the line.