Processing only appended data in TextChange

I use a regular expression to put any color on the matched text in TextChange event of Textarea.
Normally 2000 lines are loaded into that Textarea at the first loading, then texts are added through ‘tail -f’ shell command(textarea.appendtext)

As you might expect, due to the TextChange, all of the Textarea text(previous text + newly added text) are processed whenever any new data comes in.
The code is like :
inputString=Me.text ( TextChange event of Textare ).

Is there any way for me to process the only added data in TextChange event or something?

Thanks in advance,

What you are attempting to do is quite complex… and is available in the two controls mentioned in your topic about adding line numbers (note : the Custom Text Edit field is available as source code, and might be a good learning tool for you).

But it is more than just processing the “new” text. you have to process that text in the context of the text that existed.

Are you in the middle of a block comment (/* */), or the end of a line comment (// or ’ etc), or did you just remove a comment designator, the same thing needs to be considered for adding (or deleting), words or parts of words.

This is far far beyond what can be done (easily or quickly) with a TextEdit control (trust me, I wrote a program identical to the Custom Edit Field, long ago… prior to moving to XOJO).

The TextArea would be “ok” for doing small amounts of text (a few 1,000 characters perhaps), but you would need to analyze THE whole area, unless you created algorithms such as CEF did (which by the way uses a CANVAS control, not a TEXTAREA)

If you requirement is more simple than this… then process the data as a STYLERUN BEFORE you append it, then append the STYLERUN not the “plain text”

Yes, I think my requirement is very simple. My textarea is ReadOnly and just several lines are added after initial loading.
As you mentioned, it would be better to make a method styling the appended text rather than using TextChange event.
Do I understand correctly?

If you are only appending, it seems simple enough to track the index of the last line that was processed and continue processing from there.

It is a really good idea. I will try that.

Thank you!