class: Tools::CodeNavigationService
comment/format in:
#highlightLine:fromLine:col:toLine:col:
#highlightWithoutClearFromLine:col:toLine:col:
changed:5 methods
--- a/Tools__CodeNavigationService.st Fri Jun 14 16:34:30 2013 +0200
+++ b/Tools__CodeNavigationService.st Fri Jun 14 16:34:43 2013 +0200
@@ -261,17 +261,23 @@
!
isQuickMenuModifierPressed
+ |sensor|
+
+ sensor := textView sensor.
UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[
- ^ textView sensor ctrlDown
+ ^ sensor ctrlDown
].
- ^ textView sensor metaDown
+ ^ sensor metaDown
!
isQuickMenuModifierReleased
+ |sensor|
+
+ sensor := textView sensor.
UserPreferences current codeView2QuickSendersAndImplementorsOnControl ifTrue:[
- ^ textView sensor ctrlDown not
+ ^ sensor ctrlDown not
].
- ^ textView sensor metaDown not
+ ^ sensor metaDown not
!
keyPress:key x:x y:y in:view
@@ -302,15 +308,24 @@
"/ codeView syntaxElements: nil.
"/ ^ false
"/ ].
- (key == #CursorRight
- or:[key == #CursorDown
- or:[key == #CursorLeft
- or:[key == #CursorUp]]]) ifTrue:[
- view sensor pushUserEvent:#highlightVariableAtCursor for:self .
+
+ view sensor metaDown ifTrue:[
+ (key == #CursorRight or:[key == #CursorDown]) ifTrue:[
+ view sensor pushUserEvent:#findNextVariableFromCursor for:self.
+ ] ifFalse:[
+ view sensor pushUserEvent:#findPreviousVariableFromCursor for:self.
+ ]
] ifFalse:[
- view sensor pushUserEvent:#highlightClear for:self .
+ (key == #CursorRight
+ or:[key == #CursorDown
+ or:[key == #CursorLeft
+ or:[key == #CursorUp]]]
+ ) ifTrue:[
+ view sensor pushUserEvent:#highlightVariableAtCursor for:self .
+ ] ifFalse:[
+ view sensor pushUserEvent:#highlightClear for:self .
+ ]
]
-
].
^ false
@@ -331,7 +346,7 @@
"/ because it is delegated, the position is not correct
ev := WindowGroup lastEventQuerySignal query.
p := view device translatePoint:(ev x @ ev y) fromView:ev view toView:view.
- self highlightClear.
+ "/ self highlightClear.
"/ view sensor pushUserEvent:#highlightClear for:self.
^ false "/ true -- do not eat the event
].
@@ -396,11 +411,13 @@
syntaxElements isEmptyOrNil ifTrue:[
^ nil.
].
- index := syntaxElements indexForInserting:characterPosition.
- index > syntaxElements size ifTrue:[^nil].
- element := syntaxElements at:index ifAbsent:nil.
- element notNil ifTrue:[
- (characterPosition between: element start - 1 and: element stop) ifTrue:[^element].
+ 0"1" to:0 by:-1 do:[:d |
+ index := (syntaxElements indexForInserting:characterPosition) - d.
+ index > syntaxElements size ifTrue:[^nil].
+ element := syntaxElements at:index ifAbsent:nil.
+ element notNil ifTrue:[
+ (characterPosition between: element start - 1 and: element stop) ifTrue:[^element].
+ ].
].
^nil
@@ -554,23 +571,20 @@
highlightLine:lineNo fromLine:startLine col:endLine toLine:startCol col:endCol
|line start end|
- (lineNo between:startLine and:endLine) ifFalse:[
- ^ self
- ].
+ (lineNo between:startLine and:endLine) ifFalse:[ ^ self ].
line := textView listAt:lineNo.
line isEmpty ifTrue:[^self].
- start := lineNo = startLine ifTrue:[
- startCol
- ] ifFalse:[
- line indexOfNonSeparator
- ].
- end := lineNo = endLine ifTrue:[
- endCol
- ] ifFalse:[ line size ].
+ start := (lineNo = startLine)
+ ifTrue:[ startCol ]
+ ifFalse:[ line indexOfNonSeparator ].
+ end := (lineNo = endLine)
+ ifTrue:[ endCol ]
+ ifFalse:[ line size ].
line
emphasisFrom:(start max: 1)
to:(end min: line size)
add: currentEmphasis.
+
linesToRedraw add: lineNo.
"Created: / 25-06-2010 / 14:15:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -619,11 +633,11 @@
highlightWithoutClearFromLine: startLine col: startCol toLine: endLine col: endCol
- textView list keysAndValuesDo:
- [:lineNo :line|
- |start end|
- line isText ifTrue:
- [self highlightLine: lineNo fromLine: startLine col: endLine toLine: startCol col: endCol]].
+ textView list keysAndValuesDo: [:lineNo :line|
+ line isText ifTrue: [
+ self highlightLine: lineNo fromLine: startLine col: endLine toLine: startCol col: endCol
+ ]
+ ].
"Created: / 25-06-2010 / 14:15:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
@@ -643,14 +657,14 @@
!CodeNavigationService class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.23 2013-06-06 17:41:36 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.24 2013-06-14 14:34:43 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.23 2013-06-06 17:41:36 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.24 2013-06-14 14:34:43 cg Exp $'
!
version_SVN
- ^ '$Id: Tools__CodeNavigationService.st,v 1.23 2013-06-06 17:41:36 cg Exp $'
+ ^ '$Id: Tools__CodeNavigationService.st,v 1.24 2013-06-14 14:34:43 cg Exp $'
! !