richmemo: mitigrate range operations

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3818 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
skalogryz
2014-12-02 03:14:02 +00:00
parent 794f556efe
commit f75c4cc370

View File

@ -464,9 +464,9 @@ function TCustomRichMemo.GetContStyleLength(TextStart: Integer): Integer;
var
ofs, len : Integer;
begin
if GetStyleRange(TextStart, ofs, len) then Result := len - (TextStart-ofs)
else Result := 1;
if Result = 0 then Result := 1;
if GetStyleRange(TextStart, ofs, len)
then Result := len - (TextStart-ofs)
else Result := 0;
end;
procedure TCustomRichMemo.SetSelText(const SelTextUTF8: string);
@ -550,7 +550,7 @@ begin
end;
l := GetContStyleLength(i);
if i + l > j then l := j - i;
if l = 0 then l := 1;
if l = 0 then Break;
SetTextAttributes(i, l, p);
inc(i, l);
end;
@ -563,7 +563,8 @@ var
m : TParaMetric;
begin
repeat
GetParaRange(TextStart, TextStart, ln);
if not GetParaRange(TextStart, TextStart, ln) then Break;
if ln=0 then Break;
GetParaMetric(TextStart, m);
if pmm_FirstLine in ModifyMask then m.FirstLine:=ParaMetric.FirstLine;