ANSI Color and TRichEdit
Posted on 2000-03-10
I'm trying to use a RichEdit box to create a custom terminal emulation
program that supports ANSI color codes (no other ANSI Escape codes are
needed currently), however, I've run into a slight problem with the
RichEdit control. If I try to set the text on the control via
RichEdit1.Text := RichEdit1.Text + 'Blah blah'; or
RichEdit1.Lines.Text := RichEdit1.Lines.Text + 'Blah blah'; it strips
all my color and style changes. However, if I use
RichEdit1.Lines.Add() or RichEdit1.Lines.Append(), it automatically
inserts a line break, which I don't want.
So far, any simple processes I've thought of to eliminate this haven't
worked. I store the raw text with ANSI codes in a separate text file
and reparse the entire RichEdit control with an array of positions and
style/color definitions, but that would be extremely slow once I have
1000 lines or so.
Is there any simpler way to do this? Or perhaps any alternate
components I could use which would parse this for me automatically?