Understanding the Diff

SemanticDiff works internally very different than traditional diff utilities. This, along with support for additional features, results in differences in the visual presentation. You may encounter visual elements you are not familiar with. In this part of the documentation we explain everything you need to know to fully understand our diff view.

Before we explain the different parts of the interface, it helps to understand one major difference. Traditional diff utilities show how the old lines map onto the new lines. If two lines have enough overlap, they are considered related and are displayed next to each other in the side-by-side view. Otherwise, they are shown as added or deleted lines. Such a line based approach doesn’t work for SemanticDiff. The same code construct can take up a different number of lines depending on how many line breaks have been added. Therefore, SemanticDiff doesn’t work with lines, but with “blocks”. A block contains a list of old lines and new lines that correspond to the same code. Often these blocks will contain exactly one old line and one new line and you will not notice any difference to other tools. In other cases you may notice some practical differences:

For example, SemanticDiff does not align individual lines (since this may be impossible), but only blocks. You may see sections where the lines on the left and right side of the diff are displayed independently. A line on one side may take up the same space as several lines on the other side due to text wrapping. They both belong to the same code but there is no 1:1 line mapping. You may encounter another example, when clicking the Show more button. It tries to load 20 additional lines, but may end up loading more to show complete blocks.

With this in mind click on any of the following topics to learn more about them: