From ff03c9569d1ecdd4858147213a4a63a324d8240f Mon Sep 17 00:00:00 2001 From: florian Date: Thu, 6 Mar 2008 20:20:29 +0000 Subject: [PATCH] * fixed writing of long strings when using the crt unit on win32, resolves #8843 git-svn-id: trunk@10449 - --- rtl/win/crt.pp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/rtl/win/crt.pp b/rtl/win/crt.pp index a59ec4935f..013cd364ad 100644 --- a/rtl/win/crt.pp +++ b/rtl/win/crt.pp @@ -645,19 +645,29 @@ var WinAttr : word; i: integer; begin - WritePos.X := currX - 1; - WritePos.Y := currY - 1; - - WriteConsoleOutputCharacter(GetStdhandle(STD_OUTPUT_HANDLE), @s[1], Length(s), writePos, numWritten); + WritePos.X:=currX-2; + WritePos.Y:=currY-1; WinAttr:=TextAttr; - dec(WritePos.X); - for i:=0 to Length(s)-1 do + for i:=1 to Length(s) do begin - inc(WritePos.X); + Inc(WritePos.X); + WriteConsoleOutputCharacter(GetStdhandle(STD_OUTPUT_HANDLE), @s[i], 1, writePos, numWritten); WriteConsoleOutputAttribute(GetStdhandle(STD_OUTPUT_HANDLE),@WinAttr, 1, writePos, numWritten); + Inc(CurrX); + if CurrX>WindMaxX then + begin + CurrX:=WindMinX; + Inc(CurrY); + While CurrY>WindMaxY do + begin + RemoveLine(1); + Dec(CurrY); + end; + WritePos.X:=currX-2; + WritePos.Y:=currY-1; + end; end; - Inc(CurrX,Length(s)); end; @@ -678,7 +688,7 @@ begin if s<>'' then begin WriteStr(s); - s:=''; + s:=''; end; WriteChar(f.buffer[i]); end