FileBrowser.st
changeset 3635 10d452f32aeb
parent 3627 468fdc3e6b72
child 3636 ca3b257576c5
--- a/FileBrowser.st	Thu Apr 11 17:22:44 2002 +0200
+++ b/FileBrowser.st	Sat Apr 13 15:07:12 2002 +0200
@@ -3120,8 +3120,9 @@
 !
 
 goodRenameDefaultFor:oldName lastOld:lastOldName lastNew:lastNewName
-    |prefix suffix lastSuff thisSuff lastNewSize lastOldSize t 
-     lastOldWOSuffix lastNewWOSuffix oldWOSuffix lastOldRest oldRest lastNewRest|
+    |prefix suffix lastNewSize lastOldSize t n
+     lastOldWOSuffix lastNewWOSuffix oldWOSuffix lastOldRest oldRest lastNewRest
+     lastRemoved lastInserted|
 
     lastNewName isNil ifTrue:[ ^ nil].
 
@@ -3169,6 +3170,18 @@
         ].
     ].
 
+    suffix := (Array with:lastOldWOSuffix with:lastNewWOSuffix) longestCommonSuffix.
+    suffix size > 0 ifTrue:[
+        "/ last change changed something at the beginning
+        prefix := oldWOSuffix commonPrefixWith:lastOldWOSuffix ignoreCase:false.
+        prefix size > 0 ifTrue:[
+            "/ this name starts with the same characters
+            lastRemoved := lastOldWOSuffix copyWithoutLast:suffix size.
+            lastInserted := lastNewWOSuffix copyWithoutLast:suffix size.
+            ^ lastInserted , (oldName copyFrom:lastRemoved size + 1)
+        ].
+    ].
+
     ^ nil
 !
 
@@ -7791,5 +7804,5 @@
 !FileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.462 2002-04-08 09:50:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FileBrowser.st,v 1.463 2002-04-13 13:07:12 cg Exp $'
 ! !