@@ -456,13 +456,13 @@ function GetLineColor(const color: EDebugLnColor): TColor; inline;
456456
457457const
458458 DebugLnFlagsHeader = String(#0 #0 );
459- DebugLnFlagsHeaderLength = Length(DebugLnFlagsHeader) + 6 ;
459+ DebugLnFlagsHeaderLength = Length(DebugLnFlagsHeader) + 7 ;
460460
461461function FlagsToByte (const flags: EDebugLnFlags): Byte; inline;
462462begin
463463 Result := 0 ;
464- if EDebugLn.CLEAR in flags then Result := Result or 1 ;
465- if EDebugLn.FOCUS in flags then Result := Result or 2 ;
464+ if EDebugLn.CLEAR in flags then Result := Result or 1 ;
465+ if EDebugLn.FOCUS in flags then Result := Result or 2 ;
466466 if EDebugLn.BACKGROUND_COLOR in flags then Result := Result or 4 ;
467467end ;
468468
@@ -477,9 +477,17 @@ function FlagsToString(const flags: EDebugLnFlags; const bgColor: TColor): Strin
477477end ;
478478
479479function FlagsFromString (var str: String; out bgColor: TColor): EDebugLnFlags;
480+ function _HexToColor (const hex: String): TColor;
481+ begin
482+ if Length(hex) = 6 then
483+ Result := (StrToInt(' $' + Copy(hex,1 ,2 )) shl 16 ) or
484+ (StrToInt(' $' + Copy(hex,3 ,2 )) shl 8 ) or
485+ StrToInt(' $' + Copy(hex,5 ,2 ))
486+ else
487+ Result := 0 ;
488+ end ;
480489var
481490 flagsByte: Byte;
482- idx: Integer;
483491begin
484492 Result := [];
485493 if (Length(Str) >= DebugLnFlagsHeaderLength) and (Str[1 ] = DebugLnFlagsHeader[1 ]) and (Str[2 ] = DebugLnFlagsHeader[2 ]) then
@@ -491,11 +499,9 @@ function FlagsFromString(var str: String; out bgColor: TColor): EDebugLnFlags;
491499 // if (flagsByte and 8 <> 0) then Include(Result, EDebugLn.TEXT_COLOR);
492500 // maybe in the future... would like multi color support per line
493501
494- idx := 4 ;
495502 if EDebugLn.BACKGROUND_COLOR in Result then
496503 begin
497- bgColor := (Ord(Str[idx]) shl 16 ) or (Ord(str[idx+1 ]) shl 8 ) or Ord(str[idx+2 ]);
498- Inc(idx, 3 );
504+ bgColor := _HexToColor(Copy(str, 4 , 6 ));
499505 end
500506 else
501507 bgColor := $0 ;
0 commit comments