The DirtyGutter plugin
Written by Shlomy Reinstein, August 2009.
Table of Contents
The DirtyGutter plugin marks dirty lines (lines modified since last save) in the
Gutter area. The dirty line information is provided by a so-called "Dirty line
provider". There are two built-in dirty line providers:
- Simple: This provider keeps track of content changes in the buffer, and
marks all types of changes (added content, removed content, modified
content) the same way, using colored markers.
The Simple provider tries to keep overall resource consumption to a minimum
(memory, I/O, CPU).
The provider supports undo/redo by maintaining its own undo information.
By default, the plugin is activated on jEdit startup, so tracking the buffer
content changes is sufficient for maintaining the undo information, but if
the plugin is installed or manually enabled using the Plugin Manager, this
provider uses a complex algorithm to build its initial undo-support information,
which includes performing all available undo and redo operations (eventually
restoring the buffer state to the plugin activation time).
- Diff: This provider keeps track of content changes in the buffer, and runs
a 'diff' algorithm between the saved file and the buffer contents whenever a
multi-line content change occurs. The 'diff' algorithm used is the same one used
by JDiffPlugin, which was "inherited" from GNU diff. Single-line content changes
are recorded internally by the provider and marked according to the type of
change - where each type has its own (configurable) marker color. The 'diff'
algorithm also marks the changes in different colors, but only for inserted /
removed lines, not for content inserted or removed within a line, which are
always considered as "changed". Hence, after running a 'diff', any other type
of marker in modified lines will be replaced with a "changed" marker.
In addition, the plugin provides a service for other plugins (e.g. SCM plugins)
to contribute dirty line providers, e.g.:
<SERVICE CLASS="lcm.DirtyLineProvider" NAME="Simple">
Any feedback would be most welcome. Please send your feedback to the jedit-users or jedit-devel mailing list.