<pre>on scrollAdjustSerialPortField  put recvUpTo(empty,0,empty) into newInput  if newInput is not empty then    get rect of fld "screen"    get (item 4 of it) - (item 2 of it)    put (it div (the textHeight of fld "screen"))-1 into linesAvail    get fld "screen" & newInput    put the number of lines in it into linesThere    if linesThere > linesAvail then      delete line 1 to (linesThere-linesAvail) of it    end if    put it into fld "screen"  end ifend scrollAdjustSerialPortField</pre>