diff -r b1d8a61319d9 -r 81ef3253fd23 DoWhatIMeanSupport.st --- a/DoWhatIMeanSupport.st Thu Aug 21 18:15:35 2003 +0200 +++ b/DoWhatIMeanSupport.st Thu Aug 21 18:25:56 2003 +0200 @@ -129,23 +129,46 @@ ^ (oldName copyWithoutLast:suffix size). ] ]. + prefix := lastOldName commonPrefixWith:lastNewName. suffix := lastOldName commonSuffixWith:lastNewName. - (prefix size > 0 and:[suffix size > 0]) ifTrue:[ - "last rename was - 'fooR' -> 'fooXR' - then, a good default for - 'barR' would be 'barXR' - " - left := lastOldName copyTo:prefix size. - right := lastOldName copyLast:suffix size. - inserted := (lastNewName copyFrom:(left size + 1)) copyWithoutLast:(right size). - ^ (oldName copyWithoutLast:right size) , inserted , (oldName copyLast:right size) + (prefix size > 0) ifTrue:[ + (suffix size > 0) ifTrue:[ + "last rename was + 'fooR' -> 'fooXR' + then, a good default for + 'barR' would be 'barXR' + " + left := lastOldName copyTo:prefix size. + right := lastOldName copyLast:suffix size. + inserted := (lastNewName copyFrom:(left size + 1)) copyWithoutLast:(right size). + ^ (oldName copyWithoutLast:right size) , inserted , (oldName copyLast:right size) + ]. + + (oldName endsWith:(lastOldName copyFrom:prefix size+1)) ifTrue:[ + "last rename was + 'fooX' -> 'fooY' + then, a good default for + 'barX' would be 'barY' + " + left := oldName copyWithoutLast:(lastOldName copyFrom:prefix size+1) size. + right := lastNewName copyFrom:prefix size+1. + ^ left , right + ] ]. ^ nil " + self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'fooXX' + self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'XXfoo' + + self goodRenameDefaultFor:'barXX' lastOld:'fooXX' lastNew:'foo' + self goodRenameDefaultFor:'XXbar' lastOld:'XXfoo' lastNew:'foo' + + self goodRenameDefaultFor:'barXX' lastOld:'fooXX' lastNew:'fooYY' + self goodRenameDefaultFor:'XXbar' lastOld:'XXfoo' lastNew:'foo' + self goodRenameDefaultFor:'bar2' lastOld:'foo1' lastNew:'foo01' " ! @@ -270,5 +293,5 @@ !DoWhatIMeanSupport class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.11 2003-08-21 16:15:35 cg Exp $' + ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.12 2003-08-21 16:25:56 cg Exp $' ! !