Comparing Files And Interpreting The Information In The Input Windows

Comparing Files And Interpreting The Information In The Input Windows

Info Line

At the top of each text window is its "info line". The info lines of the input windows contain a letter "A", "B" or "C", the editable filename, a button for browsing, and the line number of the first visible line in the window. (Note that window "C" is optional.) Each info line appears in a different color.

When you selected another file via browsing or finished editing the filename here by pressing enter, the new file will be loaded and compared with the already loaded file(s).


The three input windows are assigned the letters "A", "B" and "C". "A" has color blue, "B" has green and "C" has magenta. (These are the defaults, but can be changed in the Settings-Menu.)

When a difference is detected then the color shows which input file differs. When both other input files differ then the color used to express this is red by default ("Conflict color" in the Settings). This colorscheme is especially useful in the case of three input files, which will be seen in the next section (Merging).

Summary Column

Left of each text is the "summary column". If differences occurred on a line then the summary column shows the respective color. For a white-space-only difference the summary is chequered. For programming languages where white space is not so important this is useful to see at one glance if anything of importance was modified. (In C/C++ white space is only interesting within strings, comments, for the preprocessor, and some only very esoteric situations.)

The vertical line separating the summary column and the text is interrupted if the input file had no lines there. When word-wrap is enabled then this vertical line appears dotted for wrapped lines.

Overview Column

On the right side a "overview"-column is visible left of the vertical scrollbar. It shows the compressed summary column of input "A". All the differences and conflicts are visible at one glance. When only two input windows are used, then all differences appear red here because every difference is also a conflict. A black rectangle frames the visible part of the inputs. For very long input files, when the number of input lines is bigger than the height of the overview column in pixels, then several input lines share one overview line. A conflict then has top priority over simple differences, which have priority over no change, so that no difference or conflict is lost here. By clicking into this overview column the corresponding text will be shown.

Manually Aligning Lines

Sometimes the algorithm places the wrong lines next to each other. Or you want to compare one piece of text with text at a completely different position in the other file. For these situations you can manually instruct KDiff3 to align certain lines. Mark the text for which you want to improve the alignment with the mouse as you would for copy and paste in the first diff view and then choose "Add Manual Diff Alignment" in the "Diffview"-menu (keyboard shortcut "Ctrl-Y") . An orange bar will appear in the summary column next to the chosen text. Repeat this for the second and (if available) third diff view. KDiff3 will immediately recalculate the differences everytime you do this. and will align the chosen lines. Of course some of the previously matching lines in between might not match anymore.

Currently merging doesn't support the use of manual diff help.

Manually Joining and Splitting Diff Sections

In some cases KDiff3 will see too many or too few diff sections for merging. In such a case you can join or split existing sections.

Add new sections by first selecting text in the lines that belong together in either input window (as for copying to the clipboard). Then choose "Split Diff At Selection" in the "Merge" menu. Splits will be added above the first line and below the last line of the selected text. If you only want to add one section, then select text beginning at another section-split.

For joining sections in either input window select something in the lines from the sections to join. (You can join several sections in one step too.) Then choose "Join selected Diffs" in the "Merge"-menu.


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team