append text with no LF

General TRichView support forum. Please post your questions here
Post Reply
bbd
Posts: 4
Joined: Tue Dec 06, 2022 9:35 am

append text with no LF

Post by bbd »

Hi friends.
I'd like to concat some strings in a trichview.
Using
procedure Add(s: String;StyleNo:Integer);
generates automatic LF when the lenght of s is higher that the remaining space on the last line. I must expand the richview window to make s concat correctly with the previous string.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: append text with no LF

Post by Sergey Tkachenko »

Do you want to turn off word wrapping?
You can do it
- for the whole document, by assigning TRichViewEdit.WordWrap = False
- for the specified paragraph, by including rvpaoNoWrap in the Options property of paragraph style for this paragraph (RVStyle.ParaStyles[].Options).
bbd
Posts: 4
Joined: Tue Dec 06, 2022 9:35 am

Re: append text with no LF

Post by bbd »

thks for your prompt reply.
I can find no property parastyles in rvstyle and the package for lazarus doesn't seem to include a richviewedit component.
I'm using Lazarus TRichview based on Richview v0.5.1
got it from https://github.com/serbod/lazrichview
Maybe that's the reason.
bbd
Posts: 4
Joined: Tue Dec 06, 2022 9:35 am

Re: append text with no LF

Post by bbd »

In fact I don't want to turn off word wrapping.
I'd like the richview display to wrap words correctly, I mean word by word.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: append text with no LF

Post by Sergey Tkachenko »

Hmm. I released version 0.5.1 in the previous millennium.
I do not have relation to the version from https://github.com/serbod/lazrichview (actually, I did not know about it until now).

Did I understand you correctly: the problem is in line breaking of text like "this is parttially bold text" as "this is part" and "tially bold text", i.e. between text items instead of line breaking between words?
Yes, v0.5.1 has this problem, it was fixed much later.

BTW, the new commercial version is compatible with Lazarus for Windows as well.
bbd
Posts: 4
Joined: Tue Dec 06, 2022 9:35 am

Re: append text with no LF

Post by bbd »

the problem is in line breaking of text like "this is parttially bold text" as "this is part" and "tially bold text", i.e. between text items instead of line breaking between words?
No, In fact what i'm looking for is charwrap instead of wordwrap. My text is like a formula, i.e a string that might be more than 100 char long and I want to concat it to the previous string with no spaces inbetween. Currently the last string starts from the next line after the previous string so the end of the line is made of space characters.
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: append text with no LF

Post by Sergey Tkachenko »

The new version of TRichView uses advanced line breaking algorithm, so it can break not only on spaces, but in other places (for example after ")" or '?').
Also, there is an option TRVStyle.LineBreak = rvWrapAnywhere, but it affects the whole document.
Post Reply