class: Tools::CodeNavigationService
authorClaus Gittinger <cg@exept.de>
Mon, 24 Jun 2013 21:44:05 +0200
changeset 12997 f03191d56013
parent 12996 2dd2097cf678
child 12998 7ccd2bfd84d1
class: Tools::CodeNavigationService comment/format in: #highlightClear: changed: #highlightElement: #highlightInstanceVariable: #highlightLine:fromLine:col:toLine:col: #redrawLines
Tools__CodeNavigationService.st
--- a/Tools__CodeNavigationService.st	Mon Jun 24 19:29:55 2013 +0200
+++ b/Tools__CodeNavigationService.st	Mon Jun 24 21:44:05 2013 +0200
@@ -413,10 +413,10 @@
                         and:[ e isInstanceVariable
                         and:[ e name = name ]]
                     ] ifNone:nil.
-    element notNil ifTrue:[
-        codeView syntaxElementSelection:nil.
-        self highlightVariable:element
-    ].
+
+    self highlightClear.
+    codeView syntaxElementSelection:nil.
+    self highlightVariable:element.
 ! !
 
 !CodeNavigationService methodsFor:'private'!
@@ -503,6 +503,7 @@
 highlightClear: redraw
 
     codeView syntaxElementSelection == nil ifTrue:[ ^ self ].
+
     textView list isNil ifTrue:[ ^ self ].
     textView list withIndexDo:[:line :lineNo | 
         line isText ifTrue:[ 
@@ -527,10 +528,10 @@
 !
 
 highlightElement:element 
-    |e savedEmphasis|
+    |e savedEmphasis currentSelection|
 
-    codeView syntaxElementSelection == element ifTrue:[ ^ self ]. "/ no change
-    codeView syntaxElementSelection notNil ifTrue:[
+    (currentSelection := codeView syntaxElementSelection) == element ifTrue:[ ^ self ]. "/ no change
+    currentSelection notNil ifTrue:[
         self highlightClear: false.
     ].
 
@@ -615,6 +616,7 @@
     |line start end|
 
     (lineNo between:startLine and:endLine) ifFalse:[ ^ self ].
+
     line := textView listAt:lineNo.
     line isEmpty ifTrue:[^self].
     start := (lineNo = startLine) 
@@ -623,10 +625,16 @@
     end := (lineNo = endLine) 
                 ifTrue:[ endCol ] 
                 ifFalse:[ line size ].
+    line setRuns:(line runs asArray).
+"/    line 
+"/        emphasisFrom:(start max: 1)
+"/        to:(end min: line size)
+"/        put: currentEmphasis.
     line 
-        emphasisFrom:(start max: 1)
+        emphasizeFrom:(start max: 1)
         to:(end min: line size)
-        add: currentEmphasis.
+        with: currentEmphasis.
+    line setRuns:(line runs asRunArray).                              
 
     linesToRedraw add: lineNo.
 
@@ -691,7 +699,7 @@
     linesToRedraw do:[:lineNo|
         textView invalidateLine: lineNo.
     ].
-    linesToRedraw := OrderedCollection new: 1
+    linesToRedraw := OrderedCollection new
 
     "Created: / 20-07-2011 / 18:45:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (format): / 18-08-2011 / 16:01:34 / cg"
@@ -700,14 +708,14 @@
 !CodeNavigationService class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.27 2013-06-24 17:09:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.28 2013-06-24 19:44:05 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.27 2013-06-24 17:09:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.28 2013-06-24 19:44:05 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__CodeNavigationService.st,v 1.27 2013-06-24 17:09:03 cg Exp $'
+    ^ '$Id: Tools__CodeNavigationService.st,v 1.28 2013-06-24 19:44:05 cg Exp $'
 ! !