I forgot to say that using the following method version instead, I get the
result I expected:

buildPatchSequence
"This method is only implemented for backwards compatibility and testing."
^Array streamContents: [ :stream |
self
patchSequenceDoIfMatch: [ :string |
stream nextPut: #match -> string copy ]
ifInsert: [ :string |
stream nextPut: #insert -> string copy ]
ifRemove: [ :string |
stream nextPut: #remove -> string copy ] ]

#Luc



2012/10/18 Luc Fabresse <[email protected]>

> Hi All,
>
>  I tried to do a text diff using DiffMorph.
>  But if compared strings contain CR character, the display seems not be
> accurate.
>  Example:
>
> s1 := 'ab', String space, String cr, 'd', String space, String cr, 'ef'.
> s2 := 'ab', String cr, 'd', String cr, 'ef'.
>
> (DiffMorph
> from: s1
> to: s2)
>  openInWindow.
>
>   In this example, d (on line 2) is highlighted while it should not IMHO.
>   I track this until (a DiffMorph uses a TextDiffBuilder):
>
>   TextDiffBuilder>>buildPatchSequence
> ^Array streamContents: [ :stream |
> self
>  patchSequenceDoIfMatch: [ :string |
> stream nextPut: #match -> (string copyWithout: Character cr) ]
>  ifInsert: [ :string |
> stream nextPut: #insert -> (string copyWithout: Character cr) ]
>  ifRemove: [ :string |
> stream nextPut: #remove -> (string copyWithout: Character cr) ] ]
>
>
>  My question: why ignoring Character cr?
>  Should we change it?
>
> #Luc
>
>

Reply via email to