# TkDIFF+

The top row contains the File, Edit, View, Mark, Merge and Help menus. The second row contains the labels which identify the contents of each text window. Below that is a toolbar which contains navigation and merge selection tools.

The left-most text widget displays the contents of FILE1, the most recently checked-in revision, REV or REV1, respectively (as per the startup options described in the "On Command Line" help). The right-most widget displays the contents of FILE2, FILE or REV2, respectively. Clicking the right mouse button over either of these windows will give you a context sensitive menu with actions that will act on the window you clicked over. For example, if you click right over the right hand window and select "Edit", the file displayed on the right hand side will be loaded into a text editor.

At the bottom of the display is a two line window called the "Line Comparison" window. This will show the "current line" from the left and right windows, one on top of the other. The "current line" is defined by the line that has the blinking insertion cursor, which can be set by merely clicking on any line in the display. This window may be hidden if the View menu item Show Line Comparison is deselected.

All difference regions (DRs) are highlighted to set them apart from the surrounding text. The current difference region, or CDR, is further set apart so that it can be correlated to its partner in the other text widget (that is, the CDR on the left matches the CDR on the right).

Changing the CDR

The CDR can be changed in a sequential manner by means of the Next and Previous buttons. The First and Last buttons allow you to quickly navigate to the first or last CDR, respectively. For random access to the DRs, use the dropdown listbox in the toolbar or the diff map, described below.

By clicking right over a window and using the popup menu you can select Find Nearest Diff to find the diff record nearest the point where you clicked.

You may also select any highlighted diff region as the current diff region by double-clicking on it.

Operations

1. From the File menu:

The New... button displays a dialog where you may choose two files to compare. Selecting "Ok" from the dialog will diff the two files. The Recompute Diffs button recomputes the differences between the two files whose names appear at the top of the TkDiff window. The Write Report... lets you create a report file that contains the information visible in the windows. Lastly, the Exit button terminates TkDiff.

2. From the Edit menu:

Copy copies the currently selected text to the system clipboard. Find pops up a dialog to let you search either text window for a specified text string. Edit File 1 and Edit File 2 launch an editor on the files displayed in the left- and right-hand panes. Preferences pops up a dialog box from which display (and other) options can be changed and saved.

3. From the View menu:

Show Line Numbers toggles the display of line numbers in the text widgets. If Synchronize Scrollbars is on, the left and right text widgets are synchronized i.e. scrolling one of the windows scrolls the other. If Auto Center is on, pressing the Next or Prev buttons centers the new CDR automatically. Show Diff Map toggles the display of the diff map (see below) on or off. Show Merge Preview shows or hides the merge preview (see below). Show Line Comparison toggles the display of the "line comparison" window at the bottom of the display.

4. From the Mark menu: The Mark Current Diff creates a new toolbar button that will jump to the current diff region. The Clear Current Diff Mark will remove the toolbar mark button associated with the current diff region, if one exists.

5. From the Merge menu: The Show Merge Window button pops up a window with the current merged version of the two files. The Write Merge File button will allow you to save the contents of that window to a file.

6. From the Help menu: The About TkDiff button displays copyright and author information. The On GUI button generates this window. The On Command Line button displays help on the TkDiff command line options. The On Preferences button displays help on the user-settable preferences.

7. From the toolbar: The first tool is a dropdown list of all of the differences in a standard diff-type format. You may use this list to go directly to any diff record. The Next and Previous buttons take you to the "next" and "previous" DR, respectively. The First and Last buttons take you to the "first" and "last" DR. The Center button centers the CDRs in their respective text windows. You can set Auto Center in Preferences to do this automatically for you as you navigate through the diff records.

Keyboard Navigation

When a text widget has the focus, you may use the following shortcut keys: f First diff c Center current diff l Last diff n Next diff p Previous diff 1 Merge Choice 1 2 Merge Choice 2 u Switch back to directories view

The cursor, Home, End, PageUp and PageDown keys work as expected, adjusting the view in whichever text window has the focus. Note that if Synchronize Scrollbars is set in Preferences, both windows will scroll at the same time.

Scrolling

To scroll the text widgets independently, make sure Synchronize Scrollbars in Preferences is off. If it is on, scrolling any text widget scrolls all others. Scrolling does not change the current diff record (CDR).

Diff Marks

You can set "markers" at specific diff regions for easier navigation. To do this, click on the Set Mark button. It will create a new toolbar button that will jump back to this diff region. To clear a diff mark, go to that diff record and click on the Clear Mark button.

Diff Map

The diff map is a map of all the diff regions. It is shown in the middle of the main window if "Diff Map" on the View menu is on. The map is a miniature of the file's diff regions from top to bottom. Each diff region is rendered as a patch of color, Delete as red, Insert as green and Change as blue. In the case of a 3-way merge, overlap regions are marked in yellow. The height of each patch corresponds to the relative size of the diff region. A thumb lets you interact with the map as if it were a scrollbar. All diff regions are drawn on the map even if too small to be visible. For large files with small diff regions, this may result in patches overwriting each other.

Merging

To merge the two files, go through the difference regions (via "Next", "Prev" or whatever other means you prefer) and select "Left" or "Right" (next to the "Merge Choice:" label) for each. Selecting "Left" means that the the left-most file's version of the difference will be used in creating the final result; choosing "Right" means that the right-most file's difference will be used. Each choice is recorded, and can be changed arbitrarily many times. To commit the final, merged result to disk, choose "Write Merge File..." from the Merge menu.

Merge Preview

To see a preview of the file that would be written by "Write Merge File...", select "Show Merge Window" in the View menu. A separate window is shown containing the preview. It is updated as you change merge choices. It is synchronized with the other text widgets if "Synchronize Scrollbars" is on.

Credits

Thanks to Wayne Throop for beta testing, and for giving valuable suggestions (and code!) along the way. Thanks (and credit) to John Heidemann for his window tags routines, which I shamelessly stole (with permission) out of his great Tk-based Solitaire game, Klondike. Thanks to D. Elson (author of tkCVS) for writing the code that extends the RCS support to include CVS. Thanks to John Brown for writing the code that extends the revision control support to SCCS.

Major thanks to Warren Jones (wjones@tc.fluke.com) and Peter Brandstrom (qraprbm@era-lvk.ericsson.se) for going way above and beyond the call. Warren added support for NT and cleaned up the Unix code as well. Peter, independently, did the same thing and then added the new interface. The end result was the 2.x series... Many, many thanks to you both!

Major thanks also to Bryan Oakley (boakley@vignette.com), who made the GUI even more appealing... Bryan did a ton of work, the result of which was the 3.x series. Dorothy Robinson provided helpful comments and patches for 3.x, too. Thanks, Bryan and Dorothy!

Thanks to Dean Jones (dean@gallant.com) for permission to use his icons in the toolbar.

Thanks to Laurent Riesterer (laurent.riesterer@free.fr) for adding support to display the differences between files in directories.

Many, many thanks also to the many others who have written and provided ideas and encouragement and code since TkDiff was first released! I haven't done much coding since the 1.x series; almost every new feature that has come about since then has been the result of volunteer efforts. Thanks, folks!

Author
John M. Klassa

Comments

Questions and comments should be sent to the TkDiff mailing list at http://www.accurev.com/free/tkdiff.

To get it, please visit:
http://www.gnu.org/gnulist/production/diffutils.html