EditTextViewCompletionSupport.st
changeset 4817 597e3af71218
parent 4808 b37597d2df93
child 4819 2d77124d5a28
--- a/EditTextViewCompletionSupport.st	Thu Oct 24 10:14:04 2013 +0200
+++ b/EditTextViewCompletionSupport.st	Mon Oct 28 12:37:17 2013 +0100
@@ -63,10 +63,11 @@
         "/ this is done BEFORE the buttonPress event is delivered.
         "/ therefore, allow for the activate of the completionMenu and it's button event to be processed.
         "/ before forcing it to be closed...
-"/        self closeCompletionView
         editView graphicsDevice anyButtonPressed ifTrue:[
             editView sensor pushUserEvent:#editViewLostFocus for:self.
-        ].
+        ] ifFalse:[
+            self closeCompletionView
+        ]
     ].
 !
 
@@ -75,6 +76,10 @@
 
     |ch completeImmediate eatCursorLeftOrRight|
 
+    editView editedLanguage isNil ifTrue:[
+        ^ false
+    ].
+
     completeImmediate := UserPreferences current immediateCodeCompletion.
     
     "/ open on CTRL- or TAB-key?
@@ -137,6 +142,9 @@
                 ^ false "/ don' eat
             ].
 
+            (key == #BackSpace) ifTrue:[
+                ^ false "/ don' eat
+            ].
             self closeCompletionView.
             ^ false "/ don' eat
         ].
@@ -184,19 +192,26 @@
     self stopCompletionProcess.
 
     (editView sensor hasKeyPressEventFor:nil) ifTrue:[ 
+        "/ 'cl' printCR.
         self closeCompletionView. 
         ^ self
     ].
     ((cursorX := editView xOfCursor) isNil
     or:[ (cursorY := editView yOfCursor) isNil ]) ifTrue:[
         "/ no cursor - user is selecting, or cursor has been scrolled out of sight.
+        "/ 'cl2' printCR.
         self closeCompletionView. 
         ^ self
     ].
 
-    initialList := #( 'busy...' ).
-
-    self openCompletionView.
+    completionView isNil ifTrue:[
+        initialList := #( 'Busy...' ).
+        "/ 'op1' printCR.
+    ] ifFalse:[
+        initialList := completionView list.
+        "/ 'op2' printCR.
+    ].
+    self openCompletionView:initialList.
 
     completionProcess := 
         [
@@ -258,6 +273,7 @@
     "Makes sure the completion view is opened and with given `list`."
     
     | movePos topView |
+
     "/ move the window
     movePos := editView device translatePoint:(editView xOfCursor @ editView yOfCursor) fromView:editView toView:nil.
     movePos := movePos - (editView viewOrigin x @ 0).
@@ -291,10 +307,10 @@
 !EditTextViewCompletionSupport class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.3 2013-10-09 13:06:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.4 2013-10-28 11:37:17 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.3 2013-10-09 13:06:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextViewCompletionSupport.st,v 1.4 2013-10-28 11:37:17 cg Exp $'
 ! !