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
could Ardour's YTK be use...
by
Fred vS
[
Today
at 02:44:04 am]
Problem with drawing orde...
by
wp
[
Today
at 12:57:00 am]
GTK3 : Icons have borders...
by
zeljko
[March 14, 2026, 10:43:51 pm]
Initialization & finaliza...
by
Martin_fr
[March 14, 2026, 10:22:21 pm]
Getting results from sql ...
by
CraigC
[March 14, 2026, 08:15:54 pm]
Hello! Anything new?
by
440bx
[March 14, 2026, 07:51:50 pm]
CryptoLib4Pascal
by
Xor-el
[March 14, 2026, 06:17:32 pm]
Extended Module Player
by
Gigatron
[March 14, 2026, 05:32:06 pm]
CONCAT formula
by
wp
[March 14, 2026, 05:27:43 pm]
[AGGPas] Difference betwe...
by
Roland57
[March 14, 2026, 04:36:02 pm]
Questions about TFuncSeri...
by
wp
[March 14, 2026, 03:05:31 pm]
declaring Array
by
Thaddy
[March 14, 2026, 01:24:11 pm]
TChart: Wrong default val...
by
wp
[March 14, 2026, 11:30:54 am]
Text Fill (Memo)
by
paweld
[March 14, 2026, 09:09:13 am]
Qt6/Wayland clipboard: pa...
by
AlexTP
[March 14, 2026, 08:56:58 am]
Pocketbase
by
PierceNg
[March 14, 2026, 06:29:04 am]
ADUG Symposium 2026
by
Mathias Burbach
[March 14, 2026, 04:45:57 am]
Any way to "embed" Window...
by
jamie
[March 14, 2026, 12:55:37 am]
DataPort StopBits and Flo...
by
Thaddy
[March 13, 2026, 02:14:16 pm]
Lazarus Bugfix Release 4....
by
JuhaManninen
[March 13, 2026, 10:05:03 am]
88 year D. Knuth changes ...
by
Thaddy
[March 13, 2026, 07:31:38 am]
interface and GUID someth...
by
egsuh
[March 13, 2026, 03:31:00 am]
CADSys4 3D.
by
maurog
[March 13, 2026, 01:00:05 am]
UOS - pre-compiled librar...
by
Fred vS
[March 13, 2026, 12:34:06 am]
Pipewire API
by
Fred vS
[March 12, 2026, 10:11:02 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Why does this happen (Read 983 times)
Ten_Mile_Hike
Full Member
Posts: 136
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: 793
R.I.P. Free Pascal
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
Bart
Hero Member
Posts: 5706
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: 136
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: 3741
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 3, 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: 136
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: 18792
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
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
General
»
Why does this happen
TinyPortal
© 2005-2018