SmallSense__PO.st
changeset 174 3e08d765d86f
parent 133 bd659b67811c
child 176 df6d3225d1e4
--- a/SmallSense__PO.st	Tue Nov 19 13:02:56 2013 +0000
+++ b/SmallSense__PO.st	Wed Feb 26 19:06:00 2014 +0100
@@ -3,7 +3,7 @@
 "{ NameSpace: SmallSense }"
 
 HierarchicalItem subclass:#PO
-	instanceVariableNames:'subject icon label name context'
+	instanceVariableNames:'subject icon label name relevance context'
 	classVariableNames:'IconWidth'
 	poolDictionaries:''
 	category:'SmallSense-Core-Interface-PO'
@@ -79,6 +79,30 @@
     name := something.
 !
 
+relevance
+    "Return relevance value, i.e., how much likely is that this
+     is what user wants to complete.
+
+     Relevance is an integer between 1 (least relevant) and 
+     100 (most relevant)"
+
+    ^ relevance ? 1
+
+    "Modified: / 18-01-2014 / 22:41:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+relevance: anInteger
+    "Set the relevance value, i.e., how much likely is that this
+     is what user wants to complete.
+
+     Relevance is an integer between 1 (least relevant) and 
+     100 (most relevant)"
+
+    ^ relevance := anInteger.
+
+    "Modified: / 18-01-2014 / 22:41:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 stringAlreadyWritten
     "Answers a string already written in the textview"    
 
@@ -126,10 +150,11 @@
     stringAlreadyWritten := self stringAlreadyWritten.
     stringToInsert := stringToComplete copyFrom: (stringAlreadyWritten size + 1).
     textView isCodeView2 ifTrue:[textView := textView textView].
-    textView undoableDo:[
-        (stringToComplete startsWith: stringAlreadyWritten) ifTrue:[
-            textView insertStringAtCursor: stringToInsert.
-        ] ifFalse:[
+    (stringToComplete startsWith: stringAlreadyWritten) ifTrue:[
+        context support electricInsert:stringToInsert
+              ignoreKeystrokes:stringToInsert
+    ] ifFalse:[
+       textView undoableDo:[
             | startCol endCol |
 
             endCol := textView cursorCol - 1.
@@ -141,7 +166,7 @@
     textView cursorCol: textView cursorCol - stringToComplete size + (po cursorColumnAfterCompleteForLanguage: context language).
 
     "Created: / 17-10-2013 / 01:08:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 20-10-2013 / 01:46:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 21-01-2014 / 23:30:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !PO methodsFor:'displaying'!
@@ -216,7 +241,7 @@
 !
 
 version_SVN
-    ^ '$Id: SmallSenseResultItem.st 7825 2011-11-26 18:32:31Z vranyj1 $'
+    ^ '$Id: SmallSense__PO.st,v 1.2 2014/02/12 14:49:29 sr Exp $'
 ! !