|
@@ -365,70 +365,6 @@ end;
|
|
|
|
|
|
const ansitbl:array[0..7] of char='04261537';
|
|
|
|
|
|
-{$ifdef disabled}
|
|
|
-Function Attr2Ansi(Attr,OAttr:byte):string;
|
|
|
-{
|
|
|
- Convert Attr to an Ansi String, the Optimal code is calculate
|
|
|
- with use of the old OAttr
|
|
|
-}
|
|
|
-var
|
|
|
- hstr : string[16];
|
|
|
- OFg,OBg,Fg,Bg:byte;
|
|
|
-
|
|
|
- procedure AddSep(ch:char);
|
|
|
- begin
|
|
|
- if length(hstr)>0 then
|
|
|
- hstr:=hstr+';';
|
|
|
- hstr:=hstr+ch;
|
|
|
- end;
|
|
|
-
|
|
|
-begin
|
|
|
- if Attr=OAttr then
|
|
|
- begin
|
|
|
- Attr2Ansi:='';
|
|
|
- exit;
|
|
|
- end;
|
|
|
- Hstr:='';
|
|
|
- Fg:=Attr and $f;
|
|
|
- Bg:=Attr shr 4;
|
|
|
- OFg:=OAttr and $f;
|
|
|
- OBg:=OAttr shr 4;
|
|
|
-{ This resets colours to their defaults, the problem is we don't know what
|
|
|
- the default is, i.e. it can either be white on black or back on white or
|
|
|
- even something totally different. This causes undesired colour schemes
|
|
|
- in the IDE on some terminals.
|
|
|
- if (OFg<>7) or (Fg=7) or ((OFg>7) and (Fg<8)) or ((OBg>7) and (Bg<8)) then
|
|
|
- begin
|
|
|
- hstr:='0';
|
|
|
- OFg:=7;
|
|
|
- OBg:=0;
|
|
|
- end;}
|
|
|
- if (Fg>7) and (OFg<8) then
|
|
|
- begin
|
|
|
- AddSep('1');
|
|
|
- OFg:=OFg or 8;
|
|
|
- end;
|
|
|
- if (Bg and 8)<>(OBg and 8) then
|
|
|
- begin
|
|
|
- AddSep('5');
|
|
|
- OBg:=OBg or 8;
|
|
|
- end;
|
|
|
- if (Fg<>OFg) then
|
|
|
- begin
|
|
|
- AddSep('3');
|
|
|
- hstr:=hstr+AnsiTbl[fg and 7];
|
|
|
- end;
|
|
|
- if (Bg<>OBg) then
|
|
|
- begin
|
|
|
- AddSep('4');
|
|
|
- hstr:=hstr+AnsiTbl[bg and 7];
|
|
|
- end;
|
|
|
- if hstr='0' then
|
|
|
- hstr:='';
|
|
|
- Attr2Ansi:=#27'['+hstr+'m';
|
|
|
-end;
|
|
|
-{$endif}
|
|
|
-
|
|
|
function attr2ansi(attr,oattr:byte):string;
|
|
|
|
|
|
var OFg,OBg,Fg,Bg:byte;
|