Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
General
»
Why does this happen
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Can I get the position an...
by
CM630
[
Today
at 11:00:33 am]
IndySecOpenSSL is now ava...
by
tonyw
[
Today
at 10:52:47 am]
[New Component] ExtTabCtr...
by
ovidio
[
Today
at 10:36:06 am]
Sizes and SizeInt
by
Thaddy
[
Today
at 09:57:42 am]
Printer Info
by
LeP
[
Today
at 09:25:16 am]
Gitlab site history date.
by
Martin_fr
[
Today
at 09:11:14 am]
WEBP, no DLLs
by
CM630
[
Today
at 08:52:43 am]
XLibre, finally and fortu...
by
Thaddy
[
Today
at 08:49:03 am]
Dataset EnableControls/Di...
by
Sharfik
[
Today
at 07:40:21 am]
TVirtualDBTreeEx and upda...
by
Sharfik
[
Today
at 07:36:30 am]
made hooking newinstance ...
by
Thaddy
[
Today
at 06:56:17 am]
Interesting video
by
Curt Carpenter
[
Today
at 04:28:27 am]
how to add a ForEach call...
by
cdbc
[
Today
at 02:19:44 am]
I found an actual use for...
by
jamie
[June 09, 2026, 11:48:04 pm]
Lazarus Main and Gnome/Wa...
by
Jonax
[June 09, 2026, 09:02:10 pm]
MacOS post compilation sc...
by
marcou
[June 09, 2026, 07:30:07 pm]
water filling simulation
by
Dzandaa
[June 09, 2026, 06:53:35 pm]
Pdf Viewer in Pascal
by
Tomxe
[June 09, 2026, 05:00:32 pm]
How can 'Canvas does not ...
by
J-G
[June 09, 2026, 03:05:01 pm]
AArch64. Fast method to c...
by
Thaddy
[June 09, 2026, 01:58:45 pm]
Strange Behaviour at Runt...
by
andrew Bubble
[June 09, 2026, 12:41:49 pm]
Can /my/ AI help me with ...
by
microxa
[June 09, 2026, 12:12:06 pm]
Knigo
by
CM630
[June 09, 2026, 12:05:31 pm]
P.I.S.S. a PlugIn-framewo...
by
cdbc
[June 09, 2026, 11:27:35 am]
[solved] rotate image pro...
by
speter
[June 09, 2026, 10:03:42 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Why does this happen (Read 1053 times)
Ten_Mile_Hike
Full Member
Posts: 141
Why does this happen
«
on:
May 19, 2025, 10:20:59 pm »
Why does the following code produce Tmemo lines
as short as 7 to as long as 26 characters when
wordwrap is on?
There are no #13 or #10 chars in the string- S
The font is monospaced
Attached is a picture of Tmemo
Code: Pascal
[Select]
[+]
[-]
var
S
:
String
=
''
;
begin
Repeat
S
:
=
S
+
Chr
(
Random
(
95
)
+
32
)
;
//32..126
until
Length
(
S
)
>
10000
;
Memo1
.
Text
:
=
S
;
end
;
Logged
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.
Robert A. Heinlein
Fibonacci
Hero Member
Posts: 997
Behold, I bring salvation - FPC Unleashed
Re: Why does this happen
«
Reply #1 on:
May 19, 2025, 10:28:37 pm »
Because there has to be a line break somewhere, and the preferred place is a space character (32)
Logged
FPC Unleashed
- inline vars, tuples, statement expressions, array equality, compound assignments, indexed/lazy labels, no-RTTI & more. ⭐
Star it on GitHub!
Bart
Hero Member
Posts: 5727
Re: Why does this happen
«
Reply #2 on:
May 19, 2025, 10:31:02 pm »
And if there are no suitable breaking characters, Windows will break the line where it sees fit.
Bart
Logged
Ten_Mile_Hike
Full Member
Posts: 141
Re: Why does this happen
«
Reply #3 on:
May 19, 2025, 11:00:48 pm »
A simple fix for uniform line lengths is
Code: Pascal
[Select]
[+]
[-]
procedure
TForm1
.
Button1Click
(
Sender
:
TObject
)
;
var
x
:
Integer
;
s1
,
s2
:
String
;
begin
s1
:
=
''
;
s2
:
=
''
;
Memo1
.
Clear
;
Repeat
S1
:
=
S1
+
Chr
(
Random
(
95
)
+
32
)
;
//32..126
until
Length
(
S1
)
>
=
10000
;
For
x
:
=
1
To
Length
(
S1
)
Do
Begin
s2
:
=
s2
+
s1
[
x
]
;
if
x
mod
20
=
0
then
s2
:
=
s2
+
#13
#10
;
end
;
Memo1
.
Text
:
=
S2
;
end
;
But I never knew that #32 could be used as a line break by windows
Logged
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.
Robert A. Heinlein
dbannon
Hero Member
Posts: 3825
Re: Why does this happen
«
Reply #4 on:
May 20, 2025, 01:47:37 am »
Quote from: Ten_Mile_Hike on May 19, 2025, 11:00:48 pm
...
But I never knew that #32 could be used as a line break by windows
No, its not being used as a line break, its just a suitable place to insert a line break.
Davo
Logged
Lazarus 4, Linux (and reluctantly Win10/11, OSX Monterey)
My Project -
https://github.com/tomboy-notes/tomboy-ng
and my github -
https://github.com/davidbannon
Ten_Mile_Hike
Full Member
Posts: 141
Re: Why does this happen
«
Reply #5 on:
May 20, 2025, 07:26:51 am »
To be clear; is this a Windows thing or a TMemo thing?
Logged
When any government, or any church for that matter, undertakes to say to its subjects, This you may not read, this you
must not see, this you are forbidden to know, the end result is tyranny and oppression no matter how holy the motives.
Robert A. Heinlein
Thaddy
Hero Member
Posts: 19267
Glad to be alive.
Re: Why does this happen
«
Reply #6 on:
May 20, 2025, 08:37:26 am »
The maximum
line
length in a Windows textbox, which is the underlying widget on windows is 32,767. But note it may be affected by scrollbar settings.
In effect, that means that within limits it should not be Windows but the TMemo implementation.
«
Last Edit: May 20, 2025, 08:38:57 am by Thaddy
»
Logged
objects are fine constructs. You can even initialize them with constructors.
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
Why does this happen
TinyPortal
© 2005-2018