Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2026-01

TMemo.WordWrap affecting the contents in TMemo.Lines

10 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Flávio Etrusco

Hi,

AFAIR toggling WordWrap wouldn't (and shouldn't) affect the value of either Memo.Lines[0] or Memo.Lines.Text in Lazarus (or in Delphi, but I haven't used it in decades), and indeed, according to grok (?) the Embarcadero documentation states that "The wrapping has cosmetic purposes only. The text does not include any return characters that were not explicitly entered.".
Currently In Lazarus, if the first line contains a long text that gets wrapped, Lines[0] returns the truncated text. This, in turn, can generate a wrong configuration file in "Configure Build Lazarus" (ide/buildlazdialog.pas) if the Options contains lines long enough to trigger the wrapping, e.g.:

-gw3 -gl -gh- -gt -Co -Cr -Ci -Sa -Sy- -
vm3123,3124,4055,5023,5024,5025,5027,5028,5043,5044,5063,5066,5079,6058,11030,11031

Is this intended behaviour?
BTW Lazarus` configuration file bug can seemingly (and surprisingly) be fixed by using Lines.Text instead of Assign

Best regards,
Fl?vio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20260104/d1fbdcf0/attachment.htm>

Reply by email

zeljko
to Flávio Etrusco
Fl?vio Etrusco wrote 21 lines
Hi, AFAIR toggling WordWrap wouldn't (and shouldn't) affect the value of either Memo.Lines[0] or Memo.Lines.Text in Lazarus (or in Delphi, but I haven't used it in decades), and indeed, according to grok (?) the Embarcadero documentation states that "The wrapping has cosmetic purposes only. The text does not include any return characters that were not explicitly entered.". Currently In Lazarus, if the first line contains a long text that gets wrapped, Lines[0]?returns the truncated text.?This, in turn, can generate a wrong configuration file in "Configure Build Lazarus" (ide/ buildlazdialog.pas)?if?the Options contains lines long enough to trigger the wrapping, e.g.: -gw3 -gl -gh- -gt -Co -Cr -Ci -Sa -Sy- - vm3123,3124,4055,5023,5024,5025,5027,5028,5043,5044,5063,5066,5079,6058,11030,11031 Is this intended behaviour? BTW Lazarus` configuration file bug can seemingly (and surprisingly) be fixed by using Lines.Text instead of Assign

It is up to the widgetset. Qt docs also says that, BUT lazarus wraps ws text into tstringlist, so maybe that can cause problem ? Can you test with eg qt5 or qt6 on linux, maybe gtk3 also ?

zeljko

Reply by email

Bart
to zeljko
Show quoted text 6 lines
> AFAIR toggling WordWrap wouldn't (and shouldn't) affect the value of > either Memo.Lines[0] or Memo.Lines.Text in Lazarus (or in Delphi, but I > haven't used it in decades), and indeed, according to grok (?) the > Embarcadero documentation states that "The wrapping has cosmetic > purposes only. The text does not include any return characters that were > not explicitly entered.".

Well. at least on Windows, this holds.
As long as you take "The text does not ..." as "The property text does not ..."

Unfortunately ATM I have no Delphi anymore to test how it behaves w.r.t. Lines[0] behaviour.

Bart

Reply by email

Flávio Etrusco
to Bart

Bart, as a quick and least intrusive fix for the bug in "Configure Build Lazarus" bug, may you disable WordWrap in the Options memo in ide/buildlazdialog.pas?

Em dom., 4 de jan. de 2026 ?s 19:43, Bart via lazarus <

Show quoted text 29 lines
escreveu: On Sun, Jan 4, 2026 at 10:23?PM zeljko via lazarus wrote: > > AFAIR toggling WordWrap wouldn't (and shouldn't) affect the value of > > either Memo.Lines[0] or Memo.Lines.Text in Lazarus (or in Delphi, but I > > haven't used it in decades), and indeed, according to grok (?) the > > Embarcadero documentation states that "The wrapping has cosmetic > > purposes only. The text does not include any return characters that were > > not explicitly entered.". Well. at least on Windows, this holds. As long as you take "The text does not ..." as "The property text does not ..." Unfortunately ATM I have no Delphi anymore to test how it behaves w.r.t. Lines[0] behaviour. -- Bart -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20260106/9629f18d/attachment.htm>

Reply by email

n7800
to Flávio Etrusco
Bart, as a quick and least intrusive fix for the bug in "Configure Build Lazarus" bug, may you disable WordWrap in the Options memo in? ide/buildlazdialog.pas?

I believe the correct solution is to use "Lines.Text", since?it contains the ?original? (not the displayed)?text. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20260114/cdedbf0e/attachment.htm>

Reply by email

Bart
to Flávio Etrusco: Bart, as a quick and least intrusive fix for the bug in "Configure Build Lazarus" bug,…
Bart, as a quick and least intrusive fix for the bug in "Configure Build Lazarus" bug, may you disable WordWrap in the Options memo in ide/buildlazdialog.pas?

Could you please report this issue (invalid config file) on the bugtracker? Preferrably with a defunct config as the result of this bug. I'm not very familiar with the workings of the IDE, but someone else will pick it up.

Bart

Reply by email

n7800
to Bart
Could you please report this issue (invalid config file) on the bugtracker? Preferrably with a defunct config as the result of this bug. I'm not very familiar with the workings of the IDE, but someone else will pick it up.

?
I've known about this TMemo ?feature? for a long time and always use "Lines.Text" to get text from it. ?
I tested it in the "Configure?Build?Lazarus" window and can confirm that it causes problems when rebuilding (at least on Windows, I haven't tested other WS). ?
Merge request for fix:? https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/605 -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20260115/1726366f/attachment.htm>

Reply by email

Flávio Etrusco
to n7800: ? I've known about this TMemo ?feature? for a long time and always use "Lines.Text" to…

Em qua., 14 de jan. de 2026 ?s 19:45, n7800 via lazarus <

Show quoted text 18 lines
escreveu: Could you please report this issue (invalid config file) on the bugtracker? Preferrably with a defunct config as the result of this bug. I'm not very familiar with the workings of the IDE, but someone else will pick it up. I've known about this TMemo ?feature? for a long time and always use "Lines.Text" to get text from it. I tested it in the "Configure Build Lazarus" window and can confirm that it causes problems when rebuilding (at least on Windows, I haven't tested other WS). Merge request for fix: https://gitlab.com/freepascal.org/lazarus/lazarus/-/merge_requests/605

Thanks Bart and -err- n7800!
I indeed meant (intended) to create a ticket for this (and some other issues) but ended up caught in other errands.
Of course I agree with the committed fix, as Lines.Assign() also copies other properties that might be undesired there, but I`d still vote for disabling WordWrap (and adding an extra line height to the memo) as wrapping after '-' is quite messy when entering command-line options... -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20260115/3a564ae0/attachment-0001.htm>

Reply by email

n7800
to Flávio Etrusco

?

Thanks Bart and -err- n7800! I indeed meant (intended) to create a ticket for this (and some other issues) but ended up caught in other errands. Of course I agree with the committed fix, as Lines.Assign() also copies other properties that might be undesired there, but I`d still vote?for disabling WordWrap (and adding an extra line height to the memo) as wrapping after '-' is quite messy when entering command-line options... ?

?
I think the potential appearance of a horizontal scrollbar here is undesirable...

Since you don't have to write all the parameters on one line, you can simply add line breaks between options yourself to avoid awkward word breaks. ?
Of course, this will depend on the window width, but it remembers the size. So another variant -?is to simply make it wider. -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20260117/219cb87c/attachment.htm>

Reply by email