Browse Source

* update the coordinates properly if a string is written that exactly fills
a line (mantis #15599)

git-svn-id: trunk@15241 -

Jonas Maebe 15 years ago
parent
commit
45c813929a
3 changed files with 19 additions and 1 deletions
  1. 1 0
      .gitattributes
  2. 1 1
      rtl/unix/crt.pp
  3. 17 0
      tests/webtbs/tw15599.pp

+ 1 - 0
.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

+ 1 - 1
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);

+ 17 - 0
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.