Tools__CodeNavigationService.st
branchjv
changeset 13613 066908b0c801
parent 13609 8b400fde34ef
parent 13564 05ed2f6a11ab
child 13618 aa7dd2f6dc46
--- a/Tools__CodeNavigationService.st	Fri Sep 20 10:52:30 2013 +0100
+++ b/Tools__CodeNavigationService.st	Sat Sep 21 02:18:20 2013 +0100
@@ -323,6 +323,42 @@
     ^ menuShown notNil
 !
 
+findNextVariableFromCursor
+    | currentElement nextElement |
+
+    codeView hasSelection ifTrue:[
+        currentElement := self elementAtLine: textView selectionStartLine col: textView selectionStartCol.
+    ] ifFalse:[
+        currentElement := codeView syntaxElementSelection.
+    ].
+    currentElement isVariable ifTrue:[
+        nextElement := currentElement next.
+        nextElement notNil ifTrue:[
+            textView selectFrom: nextElement start to: nextElement stop. 
+        ]
+    ]
+
+    "Created: / 18-09-2013 / 13:15:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+findPreviousVariableFromCursor
+    | currentElement prevElement |
+
+    codeView hasSelection ifTrue:[
+        currentElement := self elementAtLine: textView selectionStartLine col: textView selectionStartCol.
+    ] ifFalse:[
+        currentElement := codeView syntaxElementSelection.
+    ].
+    currentElement isVariable ifTrue:[
+        prevElement := currentElement prev.
+        prevElement notNil ifTrue:[
+            textView selectFrom: prevElement start to: prevElement stop. 
+        ]
+    ]
+
+    "Created: / 18-09-2013 / 13:15:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 isQuickMenuModifierPressed
     ^ textView isQuickMenuModifierPressed
 "/
@@ -376,29 +412,32 @@
 "/            ^ false
 "/        ].
 
-        sensor metaDown ifTrue:[
-            (key == #CursorRight or:[key == #CursorDown]) ifTrue:[
-                sensor pushUserEvent:#findNextVariableFromCursor for:self.
-            ] ifFalse:[(key == #CursorLeft or:[key == #CursorUp]) ifTrue:[
-                sensor pushUserEvent:#findPreviousVariableFromCursor for:self.
-            ]].
+
+        (key == #FocusNext) ifTrue:[
+            sensor pushUserEvent:#findNextVariableFromCursor for:self.            
+            ^ true.
+        ].
+        (key == #FocusPrevious) ifTrue:[
+            sensor pushUserEvent:#findPreviousVariableFromCursor for:self.
+            ^ true.
+        ].
+
+        (key == #CursorRight
+          or:[key == #CursorDown
+          or:[key == #CursorLeft
+          or:[key == #CursorUp]]]
+        ) ifTrue:[
+            sensor pushUserEvent:#highlightVariableAtCursor for:self .
         ] ifFalse:[
-            (key == #CursorRight
-              or:[key == #CursorDown
-              or:[key == #CursorLeft
-              or:[key == #CursorUp]]]
-            ) ifTrue:[
-                sensor pushUserEvent:#highlightVariableAtCursor for:self .
-            ] ifFalse:[
-                "/ sensor pushUserEvent:#highlightClear for:self .
-            ]
+            "/ sensor pushUserEvent:#highlightClear for:self .
         ]
+
     ].
     ^ false
 
     "Created: / 06-03-2010 / 20:50:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 05-09-2011 / 05:17:30 / cg"
-    "Modified: / 27-09-2011 / 19:24:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 18-09-2013 / 15:20:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 keyRelease: key x:x y:y in: view
@@ -800,11 +839,11 @@
 !CodeNavigationService class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.37 2013-09-09 11:21:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.39 2013-09-18 14:20:55 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.37 2013-09-09 11:21:15 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.39 2013-09-18 14:20:55 vrany Exp $'
 !
 
 version_HG
@@ -813,6 +852,6 @@
 !
 
 version_SVN
-    ^ '$Id: Tools__CodeNavigationService.st,v 1.37 2013-09-09 11:21:15 cg Exp $'
+    ^ '$Id: Tools__CodeNavigationService.st,v 1.39 2013-09-18 14:20:55 vrany Exp $'
 ! !