|
Class: DiffTextView
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--SyncedMultiColumnTextView
|
+--TwoColumnTextView
|
+--DiffTextView
|
+--DiffCodeView
- Package:
- stx:libtool
- Category:
- Views-Text
- Version:
- rev:
1.72
date: 2018/07/23 07:51:58
- user: cg
- file: DiffTextView.st directory: libtool
- module: stx stc-classLibrary: libtool
- Author:
- Claus Gittinger
a view showing diff output (see unix manual pages)
in a user-friendly form.
The view is created and opened with:
d := DiffTextView openOn:text1 and:text2
or:
d := DiffTextView openOn:text1 label:l1
and:text2 label:l2
and it will show the differences side-by-side.
The colors mean:
red - removed
green - added
blue - changed
light-blue changed, but not really (i.e. spaces only)
For a real world application and use of this widget,
see the ChangesBrowsers `compare',
or the browsers 'compare with repository' functions.
Notice:
A diff command must be available on your system and found
along the PATH (you will see a warning on stderr, if there is no diff).
We use gnu-diff.
TextView
EditTextView
Diff3TextView
defaults
-
diffCommand
-
return the diff-command (with argument placeHolders)
-
diffCommandTemplate: aCommandTemplateString
-
set the diff-command template
instance creation
-
openOnClass: classA labelA: lblA andClass: classB labelB: lblB title: title ifSame: sameAction
-
provided for protocol compatibility with the VersionDiffBrowser;
actually, the classes are ignored here
-
openOnClass: someClass labelA: lblA sourceA: sourceA labelB: lblB sourceB: sourceB
-
provided for protocol compatibility with the VersionDiffBrowser;
actually, the class is ignored here
-
openOnClass: someClass labelA: lblA sourceA: sourceA labelB: lblB sourceB: sourceB title: title
-
provided for protocol compatibility with the VersionDiffBrowser;
actually, the class is ignored here
-
openOnClass: someClass labelA: lblA sourceA: sourceA labelB: lblB sourceB: sourceB title: title ifSame: sameAction
-
provided for protocol compatibility with the VersionDiffBrowser;
actually, the class is ignored here
accessing
-
text1: t1 text2: t2
-
set the two texts which are to be diffed;
execute DiffCommand and update the two textViews.
initialization
-
addNextPreviousButtons
-
-
initStyle
-
(comment from inherited method)
this method sets up all style dependent things
-
postRealize
-
(comment from inherited method)
invoked after a view was realized.
Can be redefined in subclasses to perform delayed actions.
private
-
diffListFor: text1 and: text2
-
return a raw difflist for the two texts which are to be diffed
-
processDiffList: diffList from: text1 and: text2
-
given the two texts in text1 and text2, and the diff-output in diffList,
return new left and right lists.
-
updateListsFrom: text1 and: text2 diffs: diffList
-
given the two texts in text1 and text2, and the diff-output in diffList,
update my views contents
-
updateScrollbarBackground
-
define a background in the scroller allowing quick positioning to changes
DiffTextScrollerBackground
|text1 text2|
text1 := 'hello world
here is some difference
more text
this line has been removed
more text
more text
'.
text2 := 'hello world
where is the difference ?
more text
more text
more text
this line has been added
'.
DiffTextView openOn:text1 label:'text1'
and:text2 label:'text2'
|
|