[squeak-dev] The Trunk: System-tonyg.1193.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Nov 10 08:57:53 UTC 2020
Tony Garnock-Jones uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-tonyg.1193.mcz
==================== Summary ====================
Name: System-tonyg.1193
Author: tonyg
Time: 10 November 2020, 9:57:50.481732 am
UUID: b7b2cc99-52f1-4be3-8c74-813ab33c6d23
Ancestors: System-mt.1192
Allow per-instance control over TextDiffBuilder showInsertBeforeRemove.
=============== Diff against System-mt.1192 ===============
Item was changed:
Object subclass: #TextDiffBuilder
+ instanceVariableNames: 'xLines yLines ignoreLineEndings showInsertBeforeRemove'
- instanceVariableNames: 'xLines yLines ignoreLineEndings'
classVariableNames: 'IgnoreLineEndings InsertTextAttributes NormalTextAttributes RemoveTextAttributes ShowInsertBeforeRemove'
poolDictionaries: ''
category: 'System-FilePackage'!
+ !TextDiffBuilder commentStamp: 'tonyg 11/10/2020 09:55' prior: 0!
- !TextDiffBuilder commentStamp: 'fbs 9/23/2013 08:58' prior: 0!
I implement the diff algorithm. I can show the differences between two texts. See my method comments for further information.
Instance Variables
xLines: <Array>
yLines: <Array>
ignoreLineEndings: <Boolean>
+ showInsertBeforeRemove: <Boolean> or nil
xLines
- an Array of DiffElements which is created from the first input text
yLines
- an Array of DiffElements which is created from the second input text
ignoreLineEndings
+ - a Boolean describing whether lines only differing in the line endings should be reported as a difference, or not
+
+ showInsertBeforeRemove
+ - a Boolean describing whether inserts should be processed ahead of matching removes for changed blocks, or the other way around. If nil, the system-wide preference is used (see class-side showInsertBeforeRemove).!
- - a Boolean describing whether lines only differing in the line endings should be reported as a difference, or not!
Item was changed:
----- Method: TextDiffBuilder>>patchSequenceDoIfMatch:ifInsert:ifRemove: (in category 'creating patches') -----
patchSequenceDoIfMatch: matchBlock ifInsert: insertBlock ifRemove: removeBlock
"I'm the general purpose method to iterate through the patch sequence. See my senders to learn how to use me."
| aLines bLines aBlock bBlock aLine aLineStream |
+ self showInsertBeforeRemove
- self class showInsertBeforeRemove
ifTrue: [ aLines := xLines. bLines := yLines. aBlock := insertBlock. bBlock := removeBlock ]
ifFalse: [ aLines := yLines. bLines := xLines. aBlock := removeBlock. bBlock := insertBlock ].
aLineStream := aLines readStream.
bLines do: [ :bLine |
bLine hasMatch
ifFalse: [
aBlock value: bLine string ]
ifTrue: [
[ (aLine := aLineStream next) == nil or: [ aLine == bLine match ] ]
whileFalse: [ bBlock value: aLine string ].
matchBlock value: bLine string ] ].
[ (aLine := aLineStream next) == nil ] whileFalse: [
bBlock value: aLine string ]!
Item was added:
+ ----- Method: TextDiffBuilder>>showInsertBeforeRemove (in category 'creating patches') -----
+ showInsertBeforeRemove
+ ^ showInsertBeforeRemove ifNil: [self class showInsertBeforeRemove]!
Item was added:
+ ----- Method: TextDiffBuilder>>showInsertBeforeRemove: (in category 'creating patches') -----
+ showInsertBeforeRemove: aBoolean
+ showInsertBeforeRemove := aBoolean!
More information about the Squeak-dev
mailing list
|