Page 1 of 1

append text with no LF

Posted: Tue Dec 06, 2022 9:48 am
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.

Re: append text with no LF

Posted: Tue Dec 06, 2022 1:26 pm
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).

Re: append text with no LF

Posted: Tue Dec 06, 2022 1:55 pm
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.

Re: append text with no LF

Posted: Tue Dec 06, 2022 2:33 pm
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.

Re: append text with no LF

Posted: Tue Dec 06, 2022 7:31 pm
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.

Re: append text with no LF

Posted: Tue Dec 06, 2022 8:38 pm
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.

Re: append text with no LF

Posted: Wed Dec 07, 2022 10:04 am
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.