Authors: André Kaplan, Mark Wickens, Dale Anson
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, Front-Cover Texts or Back-Cover Texts, each as defined in the license. A copy of the license can be found in the file COPYING.DOC.txt included with jEdit.
JDiffPlugin is a visual diff and merge utility for jEdit.
It features:
Diff overviews (local and global)
Synchronized scrolling
Ignore case option
Ignore leading and trailing whitespace option
Ignore amount of whitespace option
Ignore all whitespace option
Normal diff output
Visual merging of differences between two files
The simplest method is to open the Dual Diff Dialog (Plugins -> JDiff -> Show dual diff dialog) and choose the files to compare.
But you can also:
Split your view in two (vertically)
Edit the buffers you want to compare:
the buffer on the left is the original
the buffer on the right is the revision
Activate JDiff: Plugins > JDiff> Dual Diff
Or if you have JDiff docked:
Figure 1 shows the result
Once JDiff is activated as in Figure 1, you should see:
Text Highlights
A local overview (right of the original)
A global overview (right of the revision)
If you have activated the Diff dockable, you'll also see the merge controls and the line overview.
By default:
Changed lines appear in yellow
Deleted (from the original) lines appear in red
Inserted (to the revision) lines appear in green
Invalid lines appear as thin dark grey lines.
In the original, invalid lines indicate where a block was inserted in the revision.
In the revision, invalid lines indicate where a block was deleted in the original.
The local overview shows how the visible changed/inserted/deleted blocks from the original and the revision relate to each other. Merging between files can be performed by clicking a right arrow in the local overview, which will select the corresponding text from the original and replace the related text in the revision. The blocks to be merged are indicated by vertical black bars so it is obvious which code is moving. Clicking a left arrow in the local overview will select the corresponding text block from the revision and replace the related text in the original. Note that the code moves are by block, not by line, so the entire diff will be moved.
The global overview should help you estimate how the two edited buffers differ. It also displays two cursors which indicate the visible parts of the two buffers. Clicking within the global overview will move the view to the corresponding part of the file.
The line overview shows character-by-character differences between the current cursor lines within a diff block. This makes it easy to see the difference of even a single character change between the left and right lines. This overview only shows one line at a time of the diff block, move the cursor within the block to see the individual line differences for each line.
The merge control has 8 buttons. From left to right in horizontal mode:
The merge controls can also be displayed vertically or in a compact form (as shown in the image above), and with or without the line overview. The vertical display is convenient for the left or right docking areas. The horizontal layout works well in the top or bottom docking areas. The compact layout uses less vertical space in the top or bottom docking areas when the line overview is also displayed.
These commands are available on the plugin menu:
Refresh: refreshes the diff display
Go to previous/next difference
Ignore case: toggles the "Ignore case" option for the current diff
Ignore leading and trailing whitespace: toggles the "Ignore leading and trailing whitespace" option for the current diff
Ignore amount of whitespace: toggles the "Ignore amount of whitespace" option for the current diff
Ignore all whitespace: toggles the "Ignore all whitespace" option for the current diff
Normal Diff Output: generates a diff file using the normal method
These settings can be made in the JDiff options panel, Plugins -> Plugin Options... -> JDiff Plugin
You can configure how JDiff compares lines by default. JDiff can:
Ignore case: upper-cased lines are compared.
Ignore leading and trailing whitespace: lines are compared as if leading and trailing whitespaces were removed.
Ignore amount of whitespace: lines are compared as if any
leading and trailing whitespaces were removed
sequence of whitespaces were replaced by one single space.
Ignore all whitespace: lines are compared as if:
any leading, trailing and inner whitespaces were removed
Automatically display dockable on diff: When starting a new diff from the plugin menu, if on, this setting will cause the diff dockable to be displayed immediately so the merge controls are quickly accessible.
Show line diffs in dockable: Toggles display of the line diff in the dockable. Turning this off will reduce the amount of screen space the dockable occupies.
Merge control layout
You can configure the colors of:
Changed lines
Deleted lines
Inserted lines
Invalid lines
Left cursor in the global overview
Right cursor in the global overview
You can configure the colors of:
Changed lines
Deleted lines
Inserted lines
Invalid lines
The source code is distributed under the GPL. Please see http://www.fsf.org/copyleft/gpl.html
The preferred way to send bug reports is to use the Sourceforge Bug Tracker at http://sourceforge.net/bugs/?group_id=588
You can also write to:
jEdit-users mailing-list jedit-users@lists.sourceforge.net
or jEdit-devel mailing-list mailto:jedit-devel@lists.sourceforge.net
Version 1.8. Bug fixes, added "Diff" and "Refresh" buttons to merge controls, major code refactoring to clean up the various painting issues.
Version 1.7. Added a dockable to display line diff and merge controls. Added merge functionality, added mouse listener to global overview. (Dale Anson)
Version 1.5.2. Fixes to ignore whitespace options (1522563 - aconnor78)
Version 1.5, updated to work with jEdit 4.3pre3+
Version 1.4. Updated to work with jEdit v4.2+, including edits for new JEditTextArea handling and new plugin API.
Version 1.3.2. Last pre-jEdit v4.2 version of plugin by Andr??.
Stuart D. Gathman ported the GNU diff algorithm to Java. See http://www.bmsi.com/java/
Some code and ideas borrowed from JDiff by Mike Dillon (mdillon@jedit.org). See http://sourceforge.net/projects/jdiff