SmallSense__PO.st
changeset 133 bd659b67811c
parent 132 7c23c51d2cfd
child 153 b04d591c8788
child 174 3e08d765d86f
--- a/SmallSense__PO.st	Thu Oct 17 01:41:47 2013 +0100
+++ b/SmallSense__PO.st	Sun Oct 20 03:10:44 2013 +0100
@@ -79,6 +79,14 @@
     name := something.
 !
 
+stringAlreadyWritten
+    "Answers a string already written in the textview"    
+
+    ^ context wordBeforeCursor
+
+    "Created: / 20-10-2013 / 00:14:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 stringToComplete
 
     "Answers a string to complete"
@@ -115,7 +123,7 @@
     po := self.
     textView := context codeView.
     stringToComplete := po stringToCompleteForLanguage: context language.
-    stringAlreadyWritten := context wordBeforeCursor.
+    stringAlreadyWritten := self stringAlreadyWritten.
     stringToInsert := stringToComplete copyFrom: (stringAlreadyWritten size + 1).
     textView isCodeView2 ifTrue:[textView := textView textView].
     textView undoableDo:[
@@ -128,12 +136,12 @@
             startCol := textView cursorCol - stringAlreadyWritten size.
             textView insertStringAtCursor: stringToComplete.
             textView deleteFromLine:textView cursorLine col: startCol toLine:textView cursorLine col:endCol.
-            textView cursorCol: startCol + stringToComplete size.
         ].
     ].
-    textView setCursorCol: textView cursorCol - stringToComplete size + (po cursorColumnAfterCompleteForLanguage: context language).
+    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>"
 ! !
 
 !PO methodsFor:'displaying'!