I have implemented a highlighter pen (as in MS Word). When the pen is active, I set the highlight color to for instance clYellow, and when the mouse is released, the background of the selected text is set to yellow.
A slight problem: When text is selected till the end of the document, new text which is added at the end appears with the yellow background.
Here is a code snippet from the OnMouseUp event, which does not work in this respect:
Editor.SelectedTextAttr.SetBGColor(Editor.HighlightColor);
Editor.CPPosition := Editor.SelStart + Editor.SelLength;
Editor.SelLength := 0;
Editor.CurrAttr.BKColor := Editor.PaperColor;
How can I remove the yellow background for new text?