
THIHiLightMemo.HiLight -- кто писал, спрашивается...
Есть предложение, подрихтовать его маленько:
function THIHiLightMemo.HiLight;
..............
begin
if HS.Count <> 0 then
for i := HS.Count - 1 downto 0 do
if HS.Items[i] = '' then HS.Delete(i);
S := Lines[FromPos.Y];
Result := 0;
if S = '' then exit;
i := FromPos.X;
Attrs.fontcolor := Sender.Font.Color;
Attrs.FontStyle := Sender.Font.FontStyle;
StrtComm := '';
EndComm := '';
comment := false;
for j := 0 to HS.Count - 1 do
begin
U := HS.Items[j];
str := FParse(U, '=');
if U <> '' then CS := FParse(U, '=') else CS := '';
_Color := _prop_HilightFont.Color;
// ведем поиск конкретного блока засветки
block := false;
if (str[1] = '{') and (str[Length(str)] = '}') then
begin
Delete(str, 1, 1);
if str = '' then exit;
deleteTail(str, 1);
if str = '' then exit;
block := true;
end;
// ведем поиск блока комментария
k := PosEx('*', str, 1);
if k > 0 then
begin
StrtComm := Copy(str, 1, k - 1);
EndComm := Copy(str, k + 1, Length(str));
comment := true;
end;
if (AnsiComp1 = 0) and comment then
begin
SetColorStr;
Result := PosEx(EndComm, S, Length(StrtComm) + 1 + i) + Length(EndComm) - FromPos.x;
exit;
end
else if (AnsiComp2 = 0) and not comment then
begin
SetColorStr;
if block then inc(i,Length(str))
else while (i < Length(S))and(S[i + 1] > ' ') do inc(i);
Result := i - FromPos.x;
exit;
end;
end;
if (S[i + 1] <= ' ') then while (i < Length(S)) and (S[i + 1] <= ' ') do inc(i)
else inc(i);
Result := i - FromPos.x;
end;