developerWorks: Building a CDT-Based Editor, Part 2: Presenting Text in the CDT

"With each character you enter, the CDT editor performs a
bewildering number of tasks. It checks for changes to the document
partitions and activates rules to further divide the text. If the
character completes a function, the editor enables subroutine
folding to minimize the text space. If the character completes a
word, it determines whether that word should be added to the index.
Further, it determines whether that character fits into the
accepted structure of a C/C++ document. If so, it updates its
internal Document Object Model (DOM). If not, it provides error
reporting through annotations.

"It's beyond the scope of this article to cover every aspect of
CDT event handling, so we'll focus on syntax styling..."