411 detect:[:e | |
411 detect:[:e | |
412 e isVariable |
412 e isVariable |
413 and:[ e isInstanceVariable |
413 and:[ e isInstanceVariable |
414 and:[ e name = name ]] |
414 and:[ e name = name ]] |
415 ] ifNone:nil. |
415 ] ifNone:nil. |
416 element notNil ifTrue:[ |
416 |
417 codeView syntaxElementSelection:nil. |
417 self highlightClear. |
418 self highlightVariable:element |
418 codeView syntaxElementSelection:nil. |
419 ]. |
419 self highlightVariable:element. |
420 ! ! |
420 ! ! |
421 |
421 |
422 !CodeNavigationService methodsFor:'private'! |
422 !CodeNavigationService methodsFor:'private'! |
423 |
423 |
424 elementAtCursor |
424 elementAtCursor |
501 ! |
501 ! |
502 |
502 |
503 highlightClear: redraw |
503 highlightClear: redraw |
504 |
504 |
505 codeView syntaxElementSelection == nil ifTrue:[ ^ self ]. |
505 codeView syntaxElementSelection == nil ifTrue:[ ^ self ]. |
|
506 |
506 textView list isNil ifTrue:[ ^ self ]. |
507 textView list isNil ifTrue:[ ^ self ]. |
507 textView list withIndexDo:[:line :lineNo | |
508 textView list withIndexDo:[:line :lineNo | |
508 line isText ifTrue:[ |
509 line isText ifTrue:[ |
509 (line hasEmphasis: currentEmphasis) ifTrue:[ |
510 (line hasEmphasis: currentEmphasis) ifTrue:[ |
510 line emphasisAllRemove:currentEmphasis. |
511 line emphasisAllRemove:currentEmphasis. |
525 "Created: / 20-07-2011 / 18:52:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
526 "Created: / 20-07-2011 / 18:52:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
526 "Modified: / 18-11-2011 / 14:58:08 / cg" |
527 "Modified: / 18-11-2011 / 14:58:08 / cg" |
527 ! |
528 ! |
528 |
529 |
529 highlightElement:element |
530 highlightElement:element |
530 |e savedEmphasis| |
531 |e savedEmphasis currentSelection| |
531 |
532 |
532 codeView syntaxElementSelection == element ifTrue:[ ^ self ]. "/ no change |
533 (currentSelection := codeView syntaxElementSelection) == element ifTrue:[ ^ self ]. "/ no change |
533 codeView syntaxElementSelection notNil ifTrue:[ |
534 currentSelection notNil ifTrue:[ |
534 self highlightClear: false. |
535 self highlightClear: false. |
535 ]. |
536 ]. |
536 |
537 |
537 currentEmphasis := savedEmphasis := self highlighEmphasisFor:element. |
538 currentEmphasis := savedEmphasis := self highlighEmphasisFor:element. |
538 currentEmphasisForAssign := nil. |
539 currentEmphasisForAssign := nil. |
613 |
614 |
614 highlightLine:lineNo fromLine:startLine col:endLine toLine:startCol col:endCol |
615 highlightLine:lineNo fromLine:startLine col:endLine toLine:startCol col:endCol |
615 |line start end| |
616 |line start end| |
616 |
617 |
617 (lineNo between:startLine and:endLine) ifFalse:[ ^ self ]. |
618 (lineNo between:startLine and:endLine) ifFalse:[ ^ self ]. |
|
619 |
618 line := textView listAt:lineNo. |
620 line := textView listAt:lineNo. |
619 line isEmpty ifTrue:[^self]. |
621 line isEmpty ifTrue:[^self]. |
620 start := (lineNo = startLine) |
622 start := (lineNo = startLine) |
621 ifTrue:[ startCol ] |
623 ifTrue:[ startCol ] |
622 ifFalse:[ line indexOfNonSeparator ]. |
624 ifFalse:[ line indexOfNonSeparator ]. |
623 end := (lineNo = endLine) |
625 end := (lineNo = endLine) |
624 ifTrue:[ endCol ] |
626 ifTrue:[ endCol ] |
625 ifFalse:[ line size ]. |
627 ifFalse:[ line size ]. |
|
628 line setRuns:(line runs asArray). |
|
629 "/ line |
|
630 "/ emphasisFrom:(start max: 1) |
|
631 "/ to:(end min: line size) |
|
632 "/ put: currentEmphasis. |
626 line |
633 line |
627 emphasisFrom:(start max: 1) |
634 emphasizeFrom:(start max: 1) |
628 to:(end min: line size) |
635 to:(end min: line size) |
629 add: currentEmphasis. |
636 with: currentEmphasis. |
|
637 line setRuns:(line runs asRunArray). |
630 |
638 |
631 linesToRedraw add: lineNo. |
639 linesToRedraw add: lineNo. |
632 |
640 |
633 "Created: / 25-06-2010 / 14:15:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
641 "Created: / 25-06-2010 / 14:15:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
634 "Modified: / 08-07-2011 / 13:02:51 / cg" |
642 "Modified: / 08-07-2011 / 13:02:51 / cg" |
689 |
697 |
690 redrawLines |
698 redrawLines |
691 linesToRedraw do:[:lineNo| |
699 linesToRedraw do:[:lineNo| |
692 textView invalidateLine: lineNo. |
700 textView invalidateLine: lineNo. |
693 ]. |
701 ]. |
694 linesToRedraw := OrderedCollection new: 1 |
702 linesToRedraw := OrderedCollection new |
695 |
703 |
696 "Created: / 20-07-2011 / 18:45:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
704 "Created: / 20-07-2011 / 18:45:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
697 "Modified (format): / 18-08-2011 / 16:01:34 / cg" |
705 "Modified (format): / 18-08-2011 / 16:01:34 / cg" |
698 ! ! |
706 ! ! |
699 |
707 |
700 !CodeNavigationService class methodsFor:'documentation'! |
708 !CodeNavigationService class methodsFor:'documentation'! |
701 |
709 |
702 version |
710 version |
703 ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.27 2013-06-24 17:09:03 cg Exp $' |
711 ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.28 2013-06-24 19:44:05 cg Exp $' |
704 ! |
712 ! |
705 |
713 |
706 version_CVS |
714 version_CVS |
707 ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.27 2013-06-24 17:09:03 cg Exp $' |
715 ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeNavigationService.st,v 1.28 2013-06-24 19:44:05 cg Exp $' |
708 ! |
716 ! |
709 |
717 |
710 version_SVN |
718 version_SVN |
711 ^ '$Id: Tools__CodeNavigationService.st,v 1.27 2013-06-24 17:09:03 cg Exp $' |
719 ^ '$Id: Tools__CodeNavigationService.st,v 1.28 2013-06-24 19:44:05 cg Exp $' |
712 ! ! |
720 ! ! |
713 |
721 |