DoWhatIMeanSupport.st
changeset 3734 0e36383745e0
parent 3731 eb92d54a47ac
child 3751 eafbe64ab0fc
--- a/DoWhatIMeanSupport.st	Mon Sep 07 20:45:48 2009 +0200
+++ b/DoWhatIMeanSupport.st	Tue Sep 08 17:56:35 2009 +0200
@@ -829,7 +829,7 @@
     node isNil ifTrue: [
         node := tree bestNodeFor: interval.
         node isNil ifTrue: [
-            node := DoWhatIMeanSupport findNodeIn:tree forInterval:interval
+            node := self findNodeIn:tree forInterval:interval
         ].
     ].
     ^ node
@@ -893,26 +893,31 @@
 !
 
 findNodeIn:tree forInterval:interval
-    |node wouldReturn|
+    |nodeFound wouldReturn|
 
-    node := nil.
-    tree nodesDo:[:each |
-        (each intersectsInterval:interval) ifTrue:[
-            (node isNil or:[node == each parent]) ifTrue:[
-                node := each
+    nodeFound := nil.
+    tree nodesDo:[:eachNode |
+        (eachNode intersectsInterval:interval) ifTrue:[
+            (nodeFound isNil or:[nodeFound == eachNode parent]) ifTrue:[
+                nodeFound := eachNode
             ] ifFalse:[
-                (node parent notNil
-                    and:[node parent isCascade and:[each parent isCascade]]) ifFalse:[^ nil]
+                (nodeFound parent == eachNode parent
+                and:[ eachNode start >= nodeFound start
+                      and:[ eachNode stop <= nodeFound stop ] ]) ifTrue:[
+                ] ifFalse:[
+                    (nodeFound parent notNil
+                    and:[nodeFound parent isCascade and:[eachNode parent isCascade]]) ifFalse:[^ nil]
+                ]
             ]
         ] ifFalse:[
-            node notNil ifTrue:[
+            nodeFound notNil ifTrue:[
                 "/ already found one - beyond that one; leave
-                wouldReturn notNil ifTrue:[wouldReturn := node].
+                wouldReturn notNil ifTrue:[wouldReturn := nodeFound].
             ]
         ].
     ].
 "/ (wouldReturn notNil and:[wouldReturn ~~ node]) ifTrue:[self halt].
-    ^ node
+    ^ nodeFound
 
     "Modified: / 20-11-2006 / 12:31:12 / cg"
 !
@@ -929,7 +934,7 @@
         nm = 'super' ifTrue:[
             ^ classProvidingNamespace superclass
         ].
-        nm first isUppercase ifTrue:[
+        nm isUppercaseFirst ifTrue:[
             "/ wouldn't it be better to simply 'evaluate' the variable ?
             nodeVal := Parser new evaluate:nm in:nil receiver:(classProvidingNamespace basicNew).
 
@@ -1800,5 +1805,5 @@
 !DoWhatIMeanSupport class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.57 2009-08-12 18:27:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.58 2009-09-08 15:56:35 cg Exp $'
 ! !