SetSelection* issues in TAdvRichEditor

I'm playing a bit with the SetSelection* and the ClearSelection() methods of TAdvRichEditor and I think they are a bit buggy. I was able to isolate and reproduce a couple of them so you can track them and fix them in a next release.

ISSUE #1:

You only need a TForm with a TAdvRichEditor and a TSpeedButton. The button only has an OnClick event with only one line:

AdvRichEditor1->SetSelectionBold(true);

I captured a video so you can see what happens for yourself. An image (or a video) is better than a thousand words.(Strange selectyion behaviour.zip)

Anyway, I will try to explain what happens. Basically, if I select a word, click the button to bold the selection, and then select the word with another word more and click the button again, the selection is enlarged for some unknown reason once the bold format has been applied properly to the selected words.

ISSUE #2

Lets add AdvRichEditor->ClearSelection() after the SetSelectionBold into the previous OnClick event.

Again, I captured a screen video with the test (Wrong caret position.zip) but I will try to explain what I see.

I select a word and click the button (bold format is applied and ClearSelection() leaves the caret at the end of the selection. Cool.

Now I select the same "bolded" word with another one that is not in bold format (so internally I suppose we are dealing with two different Elements here). Click the button and both words appears to be bold, the selection is cleared but the caret is not moved to the end of the selection but the end of (I suppose is) the Element that has been bolded (the other one already had the format).

I hope to hear news from you 'bout the issues confirmation from your side.

Thanks.

Strange selection behaviour.zip (896.3 KB)
Wrong caret position.zip (1.0 MB)

Thanks for reporting. We traced & solved this issue and can confirm the next update will address this.