I'm having trouble with something very simple, but I just can't figure out how to do it. I need to do a text style conversion over a range of text which may include several items, and may begin and end in the middle of items. So I need to:
- Split the first item where the selection starts, and create a new item from the second part of it;
Create a new style for that item based on the existing style, with modifications, and apply it;
For each subsequent item which is completely inside the selection, create a new style based on its current style with my modifications, and apply it;
for the last item, split it at the point where the selection ends, create a new item from the first part of it, and apply a modified style to that.
I know this must be straightforward, because I see it working in the Action Test demo -- so if I select a sequence of text that starts in the middle of a bold item, goes through a normal text item, and ends in the middle of an italicized item, then press Underline, each part of the selection is modified correctly. But I can't find the code which does this -- Action Test is huge, and I've never been able to get it to load in Delphi 2005 so I could debug it. (I get lots of errors about components not being found; I've never been able to get RVActions installed correctly.)
Is there an example somewhere of how to do this?
Cheers,
Martin