--- a/Tools__TextDiff2Tool.st Sun Jan 12 23:30:25 2014 +0000
+++ b/Tools__TextDiff2Tool.st Wed Apr 01 10:38:01 2015 +0100
@@ -38,7 +38,8 @@
documentation
"
- documentation to be added.
+ a little UI around the DiffTextView,
+ to show two texts side by side.
[author:]
Jan Vrany <jan.vrany@fit.cvut.cz>
@@ -462,8 +463,18 @@
(changedObject == showDiffHolder) ifTrue:[
self updateViews.
- ^self.
+ ^ self.
].
+ diffView notNil ifTrue:[
+ (diffView respondsTo:#leftTextView) ifTrue:[
+ ((changedObject == diffView leftTextView modifiedChannel)
+ or:[changedObject == diffView rightTextView modifiedChannel]) ifTrue:[
+ self enqueueMessage:#updateDiffFromChangedText for:self arguments:#().
+ ^ self.
+ ]
+ ].
+ ].
+
super update:something with:aParameter from:changedObject
"Modified: / 16-03-2012 / 12:36:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -479,9 +490,31 @@
"Created: / 16-03-2012 / 12:37:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-updateViews
+updateDiffFromChangedText
+ |leftView rightView prevCursorLine1 prevCursorCol1 prevCursorLine2 prevCursorCol2|
+
+ leftView := diffView leftTextView.
+ rightView := diffView rightTextView.
+
+ prevCursorLine1 := leftView cursorLine.
+ prevCursorCol1 := leftView cursorCol.
+ prevCursorLine2 := rightView cursorLine.
+ prevCursorCol2 := rightView cursorCol.
+
+ self textAHolder value:(leftView contents).
+ self textBHolder value:(rightView contents).
+ leftView modifiedChannel setValue:false.
+ rightView modifiedChannel setValue:false.
+
+ self updateViews.
+ leftView cursorLine:prevCursorLine1 col:prevCursorCol1.
+ rightView cursorLine:prevCursorLine2 col:prevCursorCol2.
+!
+
+updateViews
| a b |
+
a := self textAHolder value.
b := self textBHolder value.
@@ -527,8 +560,8 @@
diffView scrolledView
text1: self textAHolder value
text2: self textBHolder value
- ]
-
+ ].
+ diffView textViews do:[:each | each modifiedChannel addDependent:self].
].
"Created: / 16-03-2012 / 13:30:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -539,7 +572,7 @@
initializeDiffView
"superclass Tools::TextDiffTool says that I am responsible to implement this method"
- ^ Tools::Diff2CodeView2 new
+ ^ Tools::DiffCodeView2 new
"Modified: / 16-01-2013 / 11:58:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
@@ -601,11 +634,11 @@
!TextDiff2Tool class methodsFor:'documentation'!
version
- ^ '$Id: Tools__TextDiff2Tool.st 8088 2013-01-16 11:59:55Z vranyj1 $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__TextDiff2Tool.st,v 1.5 2015-02-25 16:15:39 cg Exp $'
!
version_CVS
- ^ '§Header: /cvs/stx/stx/libtool/Tools__TextDiffTool.st,v 1.6 2011/11/18 14:05:39 cg Exp §'
+ ^ '$Id: Tools__TextDiff2Tool.st,v 1.5 2015-02-25 16:15:39 cg Exp $'
!
version_HG
@@ -614,6 +647,6 @@
!
version_SVN
- ^ '$Id: Tools__TextDiff2Tool.st 8088 2013-01-16 11:59:55Z vranyj1 $'
+ ^ '$Id: Tools__TextDiff2Tool.st,v 1.5 2015-02-25 16:15:39 cg Exp $'
! !