Page 1 of 1

Wordwrapped Lines to Paragraphs

Posted: Fri Nov 05, 2021 3:55 pm
by standay
Hi Sergey,

I have a regular old rve paragraph of text. I apply a right indent to it, and the text wraps to that indent. Now, how can I convert all the places where it wraps to #13 hard returns? In other words, turn all the wordwrapped lines into separate paragraphs?

Thanks Sergey. I've tried to figure it out but having no luck.

Stan

Re: Wordwrapped Lines to Paragraphs

Posted: Sun Nov 07, 2021 5:59 pm
by standay
I think I found the basic answer here:

https://www.trichview.com/forums/viewto ... ard+breaks

It's crude but it works and I aonly want it for small amounts of text.

Sergey, is there any different or newer answer for this, or is the link above what I should do?

Thanks

Stan

Re: Wordwrapped Lines to Paragraphs

Posted: Mon Nov 08, 2021 1:06 pm
by Sergey Tkachenko
This is still the simplest way to make it in an undoable way. But sending WM_KEYDOWN now can be replaced by SplitAtCaret function.

Also, there now there is a method that can split text item in non-undoable way efficiently (RVSplitTextItem from RVLinear.pas).
If you need, I can create a sample code that uses it.

Re: Wordwrapped Lines to Paragraphs

Posted: Mon Nov 08, 2021 5:40 pm
by standay
Hi Sergey,

I could not get SplitAtCaret to do anything. If you have some simple example that would be great.

As far as RVSplitTextItem, I'm using v19.5 and my RVLinear does not seem to have anything like that in it.

Any ideas appreciated!

Stan

Re: Wordwrapped Lines to Paragraphs

Posted: Mon Nov 08, 2021 5:56 pm
by Sergey Tkachenko
Sorry, I was wrong about SplitAtCaret.
It can break a text item at the caret position, but it does not make a paragraph break.
So the original code should not be changed.

I misprinted, this function is in RVInsertItems.pas. However, like SplitAtCaret, it breaks a text item, but does not make a paragraph break, so additional code is required to make it.

Re: Wordwrapped Lines to Paragraphs

Posted: Mon Nov 08, 2021 6:50 pm
by standay
OK, good to know. I modified the older code a little so it only changes the selection and it should work for what little I'll do with it.

Thanks Sergey

Stan