class: DoWhatIMeanSupport
authorClaus Gittinger <cg@exept.de>
Thu, 29 Aug 2013 20:28:28 +0200
changeset 4350 8771e73d16bb
parent 4349 f494a369c0bc
child 4351 858c0249bb5a
class: DoWhatIMeanSupport changed: #codeCompletionForMethod:into:
DoWhatIMeanSupport.st
--- a/DoWhatIMeanSupport.st	Thu Aug 29 19:05:15 2013 +0200
+++ b/DoWhatIMeanSupport.st	Thu Aug 29 20:28:28 2013 +0200
@@ -2086,7 +2086,7 @@
     |crsrPos
      selectorSoFar matchingSelectors
      selectors distances best rest 
-     allExistingMethods nameBag namesByCount selectors1 selectors2|  
+     allExistingMethods nameBag namesByCount selectors1 selectors2 editAction|  
 
     "/ Transcript showCR:'m'.
     crsrPos := codeView characterPositionOfCursor - 1.
@@ -2173,23 +2173,28 @@
                     selectors1 := selectors1 collect:[:sel | sel allBold].
                     selectors := selectors1,selectors2.
                 ].
+
+                editAction := 
+                    [:selectedCOmpletionIndex |
+
+                        best := selectors at:selectedCOmpletionIndex.
+                        rest := best copyFrom:selectorSoFar size.
+                        codeView
+                            undoableDo:[ 
+                                codeView 
+                                    replaceFromCharacterPosition:crsrPos+1 
+                                    to:crsrPos+1 
+                                    with:rest 
+                            ]
+                            info:'Completion'.
+                        codeView cursorToCharacterPosition:(crsrPos+1 + rest size - 1).    
+                        codeView cursorRight. "/ kludge to make it visible   
+                    ].
                 
                 "/ best := self askUserForCompletion:'selector' for:codeView at:(node start) from:selectors.
-                best := actionBlock value:selectors value:nil.
+                best := actionBlock value:selectors value:editAction.
                 best isNil ifTrue:[^ self].
-
-                rest := best copyFrom:selectorSoFar size.
-                codeView
-                    undoableDo:[ 
-                        codeView 
-                            replaceFromCharacterPosition:crsrPos+1 
-                            to:crsrPos+1 
-                            with:rest 
-                    ]
-                    info:'Completion'.
-                codeView cursorToCharacterPosition:(crsrPos+1 + rest size - 1).    
             ].
-            codeView cursorRight. "/ kludge to make it visible   
         ].
     ].
 
@@ -3703,10 +3708,10 @@
 !DoWhatIMeanSupport class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.127 2013-08-29 17:05:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.128 2013-08-29 18:28:28 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.127 2013-08-29 17:05:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.128 2013-08-29 18:28:28 cg Exp $'
 ! !