SmallSense__EditSupport.st
changeset 185 75738108cc3f
parent 177 be588b60f4b2
child 186 27c501b1c44c
--- a/SmallSense__EditSupport.st	Mon Mar 31 22:31:38 2014 +0200
+++ b/SmallSense__EditSupport.st	Mon Mar 31 23:43:25 2014 +0200
@@ -325,15 +325,22 @@
 !
 
 wordBeforeCursor
-    | currentLine wordStart wordEnd |
+    ^ self wordBeforeCursorConsisitingOfCharactersMatching: [:c | c isAlphaNumeric ].
 
+    "Created: / 27-09-2013 / 15:53:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 31-03-2014 / 23:03:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+wordBeforeCursorConsisitingOfCharactersMatching: characterMatchBlock
+    |  currentLine wordStart wordEnd |
+    textView := self codeView.
     currentLine := textView list at: textView cursorLine.
     currentLine isNil ifTrue:[ ^ '' ].
     wordEnd := textView cursorCol - 1.
     wordEnd > currentLine size ifTrue:[ ^ '' ].
     wordEnd ~~ 0 ifTrue:[
         wordStart := wordEnd.
-        [ wordStart > 0 and:[(currentLine at: wordStart) isAlphaNumeric] ] whileTrue:[
+        [ wordStart > 0 and:[characterMatchBlock value:(currentLine at: wordStart) ] ] whileTrue:[
             wordStart := wordStart - 1.
         ].
         wordStart := wordStart + 1.
@@ -343,8 +350,7 @@
     ].
     ^ ''
 
-    "Created: / 27-09-2013 / 15:53:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 17-10-2013 / 00:48:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 31-03-2014 / 23:02:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !EditSupport methodsFor:'private-completion'!