From 45c813929a51cb7ad427a886233e5c3a15b79222 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 8 May 2010 11:29:25 +0000 Subject: [PATCH] * update the coordinates properly if a string is written that exactly fills a line (mantis #15599) git-svn-id: trunk@15241 - --- .gitattributes | 1 + rtl/unix/crt.pp | 2 +- tests/webtbs/tw15599.pp | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/webtbs/tw15599.pp diff --git a/.gitattributes b/.gitattributes index 1153bc9574..207f8ff2e3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10323,6 +10323,7 @@ tests/webtbs/tw15500.pp svneol=native#text/plain tests/webtbs/tw15504.pp svneol=native#text/plain tests/webtbs/tw15530.pp svneol=native#text/pascal tests/webtbs/tw15592.pp svneol=native#text/plain +tests/webtbs/tw15599.pp svneol=native#text/plain tests/webtbs/tw15607.pp svneol=native#text/plain tests/webtbs/tw15610.pp svneol=native#text/plain tests/webtbs/tw15619.pp svneol=native#text/plain diff --git a/rtl/unix/crt.pp b/rtl/unix/crt.pp index ec8da6defa..cf15cbe17d 100644 --- a/rtl/unix/crt.pp +++ b/rtl/unix/crt.pp @@ -1142,7 +1142,7 @@ var while (SendBytes>0) do begin LeftX:=WindMaxX-CurrX+1; - if (SendBytes>LeftX) then + if (SendBytes>=LeftX) then begin ttyWrite(Copy(s,i-SendBytes,LeftX)); dec(SendBytes,LeftX); diff --git a/tests/webtbs/tw15599.pp b/tests/webtbs/tw15599.pp new file mode 100644 index 0000000000..1a94c48507 --- /dev/null +++ b/tests/webtbs/tw15599.pp @@ -0,0 +1,17 @@ +{ %interactive } + +{ the bug was that this put the 'x' at the *end* of the second line instead + of on position 14 } + +uses crt; // my terminal is 80x25 +var s:string; + +begin +clrscr; +s:=''; +gotoxy(1,2); // you need this row +while length(s)<80 do s:=s+' '; +write(s); +gotoxy(14,2); // you need this row +write('x'); // position of 'x' is wrong +end.