Problem applying text style to individual words
Posted: Thu May 12, 2016 8:34 pm
I'm using fixed textstyles with RichViewEdit, and I need to change the text styles of individual words. I'm seeing a problem where if I change the text style of the first word of a line, the style change can cause the last word of the previous line to drop to the current line.
For example, say I have 6 words, arranged like this:
Word1 Word2 Word3 Word4
Word5 Word6
If I select Word5 and apply a style change, the text shifts like this after the style is applied:
Word1 Word2 Word3
Word4 Word5 Word6
The problem seems to depend on how close Word4 is to the right margin.
I can cause the problem using this code:
I'm seeing the same thing in the Editor 2 demo if I change the text color of the first word of a line, like above.
Is there a way to prevent this ?
Thanks
For example, say I have 6 words, arranged like this:
Word1 Word2 Word3 Word4
Word5 Word6
If I select Word5 and apply a style change, the text shifts like this after the style is applied:
Word1 Word2 Word3
Word4 Word5 Word6
The problem seems to depend on how close Word4 is to the right margin.
I can cause the problem using this code:
Code: Select all
With RVStyle1 do
begin
TextStyles[1].Assign(TextStyles[0]);
TextStyles[1].Color := clBlue;
end;
ApplyTextStyle(1);
Is there a way to prevent this ?
Thanks