Wordwrapped Lines to Paragraphs

General TRichView support forum. Please post your questions here
Post Reply
standay
Posts: 256
Joined: Fri Jun 18, 2021 3:07 pm

Wordwrapped Lines to Paragraphs

Post 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
standay
Posts: 256
Joined: Fri Jun 18, 2021 3:07 pm

Re: Wordwrapped Lines to Paragraphs

Post 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
Sergey Tkachenko
Site Admin
Posts: 17291
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Wordwrapped Lines to Paragraphs

Post 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.
standay
Posts: 256
Joined: Fri Jun 18, 2021 3:07 pm

Re: Wordwrapped Lines to Paragraphs

Post 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
Sergey Tkachenko
Site Admin
Posts: 17291
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Wordwrapped Lines to Paragraphs

Post 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.
standay
Posts: 256
Joined: Fri Jun 18, 2021 3:07 pm

Re: Wordwrapped Lines to Paragraphs

Post 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
Post Reply