SynEdit.TopLine := SynEdit.Lines.Count;
should probably do it.
Couple of notes:
1) Make sure eoScrollPastEof is
NOT in SynEdit.options.
2) SynEdit.Append / Synedit.Lines.*** versus SynEdit.InsertText***
I assume you display data only? (ReadOnly)?
The user does not edit the text via the Keyboard?
If the user can edit the text, then you may want
Undo/Redo to work?
- Undo/Redo does
not work with SynEdit.Append / Synedit.Lines.*** .
- In that case you need SynEdit.InsertAtCaret / SynEdit.TextBetweenPoints ....
If you do not need undo/redo SynEdit.Append / Synedit.Lines.*** is simpler and faster. (and saves memory on not adding undo/redo)
3) If you do not need the blinking caret visible:
Add eoNoCaret to SynEdit.Options
For the font color, you need a highlighter or markup.
There is a ready made Highlighter that can take a list of words. IIRC SynAnySyn... Not sure.
Or you can add (you can add more than one)
M := TSynEditMarkupHighlightAllMulti.Create(SynEdit);
SynEdit.MarkupMgr.AddMarkUp(M); // To be owned and destroyed by SynEdit
TSynEditMarkupHighlightAll // Can Highlight all occurrences of one given word
TSynEditMarkupHighlightAllMulti // Can highlight several words (all in the same color)
Both have a property MarkupColor with several setting.
However Highlighter and Markup will all find the word anywhere in the text, not just at the start of line.
--
But if you look at TSynEditMarkupHighlightAll you can probably modify it to "start of line" only.
There is nothing that stores colors for a specific line or specific place.
So all of those will find the term to highlight by searching for it in the entire text.
Based on the above you can write code for X,Y locations. But then if you delete lines, you need to update all X/Y.