protected override void OnSelectionChanged ( SelectionEventArgs e )
{
// Design a "Token" -- Get the Last Token in the Stream
ActiproSoftware.SyntaxEditor.Token ActiproToken =
e.Selection.View.GetPreviousToken ( );
if ( ActiproToken == null )
return;
// Construct a unique Token Name for this Indicator
String TokenName = ActiproToken.StartOffset.ToString() ;
if ( Document.FindNextSpanIndicator ( ActiproToken.StartOffset, TokenName ) != null )
Document.Indicators.Remove ( Document.FindNextSpanIndicator ( ActiproToken.StartOffset, TokenName ) );
if ( Document.FindPreviousSpanIndicator ( ActiproToken.StartOffset, TokenName ) != null )
Document.Indicators.Remove ( Document.FindPreviousSpanIndicator ( ActiproToken.StartOffset, TokenName ) );
if ( ActiproToken.HighlightingStyle.Name != "Highlight" )
return;
if ( !Document.Indicators.Contains ( TokenName ) )
Document.Indicators.Add ( new HighlightIndicator ( TokenName ), ActiproToken.StartOffset, ActiproToken.Length );
}
This is what I've got so far, but it doesn't quite work. If the user edits the contents of the token by deleting either $ character, then the Highlight Style is lost, but the Indicator is not. How can I persist the indicator to exist only when the highlight style exists?
[Modified at 08/08/2005 06:43 PM]