I use TRichEdit to edit text. I have WordWrap turned on which automatically wraps text at the edge of control so that there are no scroll-bars. RichEdit width is set to fit 80 columns.
WordWrap simulates this behaviour nicely as long as you have occasional space between words. But if you have a very loooooooooooooooooong word RichEdit wrap will break it automatically and WordWrap won’t!
If I want now to access these wrapped lines I can get it through RichEdit.Lines.Text which will put automatically CRLF at column 80. If I use RichEdit.Text I get raw text with no CRLF suitable for WordWrap.
The task is not trivial to do in a custom function as I already tried and it was not a small function but might there be a way to use wrapping functions of TRichEdit? I have an idea to create hidden RichEdit but that kind of seems stupid for this task as I would have to calculate its width just to do wordwrapping – rather pointless I think.
The question – is there a way to force WordWrap to cut long words that cannot be wrapped otherwise? So if a word is 170 characters long, it would be wrapped into 3 lines 80 + 80 + 10 but also taking care of words before to fill previous and following lines?
Try this on for size: