SynEdit Highlighter

This is an old revision of SynEdit Highlighter, edited by Martin at . The current revision is 64277.

New page: = Understanding the SynEdit Highlighter = == SynEdit - Highlighter relationship == SynEdit <-> Highlighter have a n to 1 relationship. * 1 (instance of a) Highlighter can serve n (many) ...

Understanding the SynEdit Highlighter

SynEdit - Highlighter relationship

SynEdit <-> Highlighter have a n to 1 relationship.

As a result of this:

However SynEdit ensures before each call to the Highlighter that Highlighter.CurrentLines is set to the current SynEdits Lines. This way the highlighter can access the data whenever needed. The Format of the data-storage is determined by the highlighter (TSynCustomHighlighter.AttachToLines)

Scanning and Returning Highlight attributes

The Highlighter is expected to work on a per Line base.

If any text was modified, SynEdit will call (TSynCustomHighlighter.ScanFrom) with the line range. The highlighter should know the state of the previous line.

If Highlight attributes are required SynEdit will request them per Line too (looping through individual tokens on a line)

Also the BaseClass for the highlighters data (see AttachToLines) is based on per line storage, and SynEdits TextBuffer (Lines) do maintenance on this data to keep it synchronized. That is when ever lines of text are inserted or removed, so are entries inserted or removed from the highlighters data (hence it must have one entry per line).

Usually Highlighters store the end-of-line-status in this field. So if the highlighter is going to work on a line, it will continue with the state-entry from the previous line.