Fix in SmallSense::CompletionController>>startCompletionProcess - do not show "Busy..."
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 04 Nov 2013 13:48:49 -0300
changeset 143 038fdc3940f3
parent 142 211f95ac0835
child 144 a43236d0c411
Fix in SmallSense::CompletionController>>startCompletionProcess - do not show "Busy..."
SmallSense__CompletionController.st
--- a/SmallSense__CompletionController.st	Sat Oct 26 18:04:50 2013 +0100
+++ b/SmallSense__CompletionController.st	Mon Nov 04 13:48:49 2013 -0300
@@ -143,9 +143,41 @@
 !
 
 startCompletionProcess
-    super startCompletionProcess
+    "start the code completion process in the background"
+
+    |initialList cursorX cursorY|
+
+    "/ terminate any previous process
+    self stopCompletionProcess.
 
-    "Created: / 03-10-2013 / 10:57:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    (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
+    ].
+
+    completionView isNil ifTrue:[
+        initialList := #( ).
+        "/ 'op1' printCR.
+    ] ifFalse:[
+        initialList := completionView list.
+        "/ 'op2' printCR.
+    ].
+    self openCompletionView:initialList.
+
+    completionProcess := 
+        [
+            self computeCompletions.
+        ] forkAt:(Processor activePriority - 1).
+
+    "Created: / 04-11-2013 / 11:55:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 stopCompletionProcess