Comment #1 on issue 3238 by stephane.ducasse: Use Class instead of
TextDiffBuilder in changelist
http://code.google.com/p/pharo/issues/detail?id=3238Note that apparently in squeak they changed to go from word to characters
and now they are back to word for diffing.
Name: System-ul.394
Author: ul
Time: 16 November 2010, 6:14:45.768 am
UUID: a5bf1c79-3009-6b48-8c91-7454b6b9d9a2
Ancestors: System-ul.393
- restored word-based diffing in ClassDiffBuilder, because it gives
unusable results when the definitions/comments are too different. As an
enhancement to the original word-based method $' and $" are treated as
separators. Separators are not appended to the end of the words, but
treated as separate strings.
=============== Diff against System-ul.393 ===============
Item was changed:
----- Method: ClassDiffBuilder>>print:withAttributes:on: (in
category 'private') -----
+ print: aString withAttributes: attributes on: stream
- print: aCharacter withAttributes: attributes on: stream
stream
currentAttributes: attributes;
+ nextPutAll: aString!
- nextPut: aCharacter!
Item was changed:
----- Method: ClassDiffBuilder>>split: (in category 'private') -----
split: aString
+ "I return an array with aString splitted by whitespace ' and ""."
- "Diff by characters."
+ ^Array streamContents: [ :stream |
+ | input separators |
+ input := aString readStream.
+ separators := CharacterSet separators
+ add: $'; "for variables"
+ add: $"; "for comments in mc"
+ yourself.
+ [ input atEnd ] whileFalse: [
+ | word separator |
+ word := input
+ upToAnyOf: separators
+ do: [ :matchingSeparator |
+ separator := matchingSeparator ].
+ stream nextPut: word.
+ separator ifNotNil: [
+ stream nextPut: separator asString ] ] ]!
- ^aString as: Array!