The Trunk: System-nice.263.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: System-nice.263.mcz

commits-2
Nicolas Cellier uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-nice.263.mcz

==================== Summary ====================

Name: System-nice.263
Author: nice
Time: 25 February 2010, 4:10:28.97 am
UUID: e791bac6-8554-e64f-8bb0-af887fb94fc2
Ancestors: System-ul.262

Add a preference to ignore lineEndings in TextDiffBuilder.

=============== Diff against System-ul.262 ===============

Item was changed:
  Object subclass: #TextDiffBuilder
  instanceVariableNames: 'xLines yLines'
+ classVariableNames: 'IgnoreLineEndings InsertTextAttributes NormalTextAttributes RemoveTextAttributes'
- classVariableNames: 'InsertTextAttributes NormalTextAttributes RemoveTextAttributes'
  poolDictionaries: ''
  category: 'System-FilePackage'!
 
  !TextDiffBuilder commentStamp: 'klub 12/28/2009 05:06' 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>
 
  xLines
  - an Array of DiffElement which is created from the first input text
 
  yLines
  - an Array of DiffElement which is created from the second input text!

Item was added:
+ ----- Method: TextDiffBuilder class>>ignoreLineEndings: (in category 'preferences') -----
+ ignoreLineEndings: aBoolean
+ "Set the preference telling if line endings differences should be ignored or emphasized"
+
+ IgnoreLineEndings := aBoolean!

Item was added:
+ ----- Method: TextDiffBuilder class>>ignoreLineEndings (in category 'preferences') -----
+ ignoreLineEndings
+ "Answer a boolean telling if line endings differences should be ignored or emphasized"
+
+ <preference: 'ignoreLineEndings'
+ category: 'TextDiff'
+ description: 'When enabled, source code differences in line endings will be ignored.'
+ type: #Boolean>
+ ^IgnoreLineEndings ifNil: [ false ]!

Item was changed:
  ----- Method: TextDiffBuilder>>split: (in category 'private') -----
  split: aString
+ "I return an Array of strings which are the lines extracted from aString. All lines contain the line separator characters, or not depending on preference."
- "I return an Array of strings which are the lines extracted from aString. All lines contain the line separator characters"
 
  ^Array streamContents: [ :stream |
+ self class ignoreLineEndings
+ ifTrue: [aString lineIndicesDo: [ :start :endWithoutSeparators :end |
+ stream nextPut: (aString copyFrom: start to: endWithoutSeparators) ] ]
+ ifFalse: [aString lineIndicesDo: [ :start :endWithoutSeparators :end |
+ stream nextPut: (aString copyFrom: start to: end) ] ] ]!
- aString lineIndicesDo: [ :start :endWithoutSeparators :end |
- stream nextPut: (aString copyFrom: start to: end) ] ]!