I am using the latest released version from http://www.freepascal.org/ version 1.04 to port some Borland Pascal for DOS programs to Win32 console apps. I have noticed two annoying bugs in the CRT unit:
(1) ClrEOL does not respect TextBackground
In the Borland Pascal for DOS version, ClrEOL sets the background color of an entire line according to the most recent TextBackground call. However, in Free Pascal for Win 32, it sets the background color to black, regardless. Here is a sample program:
uses CRT;
begin
TextBackground(cyan);
ClrEol;
WriteLn('hi');
end.This should produce a full-width cyan line, with the letters "hi" occupying the first two spaces. Indeed, in Borland Pascal it does. However in Free Pascal, the only the "hi" have the cyan background.
(2) Keystrokes not registered until upstroke
Not only does this give the user poor visual feedback, it also has the by-product that typematic doesn't work. Try holding down the "x" key while running this program, first compiled in BP for DOS, then in FP for Win32:
uses
CRT;
var
k: char;
begin
WriteLn('Type a few words. Hit Enter to quit:');
repeat
k := ReadKey;
if k=#0 then Readkey (* discard second half of function keys *)
else write(K) (* but echo ASCII to screen *)
until k=#$0D; (* terminate with ENTER key *)
end.My compliler switches include -Sgico for what it's worth.
- Rich
