The ChameleonRichTextBox Syntax Highlighting User Control

The ChameleonRichTextBox is a second-generation syntax highlighting control, the successor to two earlier works, one part of my CleanCode library and one that I found on the CodeProject web site. The table below provides a detailed feature comparison of all three, but in a nutshell:

 

The ChameleonRichTextBox is part of the CleanCode libraries available here. It uses a modified version of the kabwla/uri guy control as a base class. The source for this modified version is also available at my download site.

 

New With CleanCode version 0.9.28 (June 2009):

 

New With CleanCode version 0.9.27 (April 2009):

 

This illustration shows the 6 types of highlighting and macro capability.

 

 

 

 

 

Topic

kabwla/uri guy SyntaxHighlightingTextBox

CleanCode SyntaxHilightTextBox

CleanCode ChameleonRichTextBox

HIGHLIGHTING   –

GENERAL

 

 

Enable/disable highlighting

Yes

Yes

Yes

Choice to hide or retain current highlighting when disabling further highlighting

No

No

Yes

Parses thoroughly

No

Ex: @abc/max(5,25) with no spaces fails.

Yes

Yes

Auto-highlight fires only when user pauses typing

No

Yes

Yes

Font color selectable

Yes

No

Yes

Font family selectable

No

No

Yes

Font style selectable

No

No

Yes

HIGHLIGHTING   –

COMMENTS

 

 

Highlight comments

Yes

Yes

Yes

Recognize block comments

Yes

Yes

Yes

Recognize end-of-line comments

Yes

Yes

Yes

Differentiate styles for block comments and end-of-line comments

Yes

No

Yes

HIGHLIGHTING   –

STRINGS

 

 

Highlight strings

Yes

Yes

Yes

Recognize multiple delimiters for strings

Yes

Yes

Yes

Differentiate styles for different string delimiters

Yes

No

Yes

HIGHLIGHTING   –

VARIABLES

 

 

Highlight variables

Yes

No

Yes

Recognize multiple delimiters for variables

Yes

Yes

Yes

Differentiate styles for different variables

Yes

No

Yes

Selectable convert-to-uppercase

No

No

Yes

Selectable convert-to-lowercase

No

No

Yes

Supports variable tokens where one is a subset of another (e.g. @@ and @)

No

NA

Yes

HIGHLIGHTING   –

KEYWORDS

 

 

Highlight keywords

Yes

Yes

Yes

Recognize multiple delimiters for keywords

Yes

Yes

Yes

Differentiate styles for different keywords

Yes

No

Yes

Enable/disable case-sensitivity on matching

Yes

No

Yes

Selectable convert-to-uppercase

No

No

Yes

Selectable convert-to-lowercase

No

No

Yes

COMMAND COMPLETION

 

 

 

Command completion

Yes

No

Yes

Enable/disable command completion

Yes

NA

Yes

Handles full range of key/mouse interaction

No

Up/down arrow only.

NA

Yes

Allows multiple words

No

NA

Yes

Allows multiple lines

No

NA

Yes

Selectable convert-to-uppercase

No

NA

Yes

Selectable convert-to-lowercase

No

NA

Yes

Selectable convert-to-matching-case

No

NA

Yes

MACROS

 

 

 

Macro substitution

No

No

Yes

Highlights place holders

NA

NA

Yes

Seek next place holder

NA

NA

Yes

USAGE / CUSTOMIZABILITY

 

 

 

Configurable to new languages

Yes

Yes

Yes

Provides several SQL dialects ready to use

No

Yes

Yes

Easy to customize
out-of-the-box

No

Needs intricate manual coding plus XML file.

No

Needs subclassing plus simple manual coding.

Yes (only needs an XML context file)

Dynamic (runtime) language customization

No

No

Yes (simply select a new context file)

RESPONSE TIME

 

 

 

Good response time for short text

Yes

Yes

Yes

Good response time for medium text

Yes

No

Too much reliance on regexps.

Yes

Good response time for long text

No

Acts on every keystroke rather than only when user pauses.

No

Too much reliance on regexps.

Yes

TEXT HANDLING

 

 

 

Search by text, wildcard, or regular expression

No

No

Yes

Replace by text, wildcard, or regular expression

No

No

Yes

Increase/decrease font size

No

Yes

Yes

Comment/uncomment region

No

Yes

Yes

Indent region left/right

No

Yes

Yes

Delete range by line boundaries

No

No

Yes

Returns selected text or all text

No

Yes

Yes

Undo/redo reset capability (allows, for example, restarting undo stack when loading a new file)

No

No

Yes

Undo/redo properly manipulates user typing only

Yes

No

Highlighting actions themselves get on the undo stack.

Yes

TABS AND SPACES

 

 

 

Toggle whether inserting a tab means a tab character or multiple spaces

No

Yes

Yes

Adjust number of spaces inserted for tab when in space-mode

No

No

Yes

MISCELLANEOUS

 

 

 

Displays available commands

No

Yes

Yes

Displays summary of context

No

No

Yes

Context menu to manipulate properties

No

No

Yes

 

 

 

 

 


This quick reference chart shows the available user commands of the ChameleonRichTextBox: