You've already forked lazarus-ccr
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:
@ -464,9 +464,9 @@ function TCustomRichMemo.GetContStyleLength(TextStart: Integer): Integer;
|
|||||||
var
|
var
|
||||||
ofs, len : Integer;
|
ofs, len : Integer;
|
||||||
begin
|
begin
|
||||||
if GetStyleRange(TextStart, ofs, len) then Result := len - (TextStart-ofs)
|
if GetStyleRange(TextStart, ofs, len)
|
||||||
else Result := 1;
|
then Result := len - (TextStart-ofs)
|
||||||
if Result = 0 then Result := 1;
|
else Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRichMemo.SetSelText(const SelTextUTF8: string);
|
procedure TCustomRichMemo.SetSelText(const SelTextUTF8: string);
|
||||||
@ -550,7 +550,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
l := GetContStyleLength(i);
|
l := GetContStyleLength(i);
|
||||||
if i + l > j then l := j - i;
|
if i + l > j then l := j - i;
|
||||||
if l = 0 then l := 1;
|
if l = 0 then Break;
|
||||||
SetTextAttributes(i, l, p);
|
SetTextAttributes(i, l, p);
|
||||||
inc(i, l);
|
inc(i, l);
|
||||||
end;
|
end;
|
||||||
@ -563,7 +563,8 @@ var
|
|||||||
m : TParaMetric;
|
m : TParaMetric;
|
||||||
begin
|
begin
|
||||||
repeat
|
repeat
|
||||||
GetParaRange(TextStart, TextStart, ln);
|
if not GetParaRange(TextStart, TextStart, ln) then Break;
|
||||||
|
if ln=0 then Break;
|
||||||
GetParaMetric(TextStart, m);
|
GetParaMetric(TextStart, m);
|
||||||
|
|
||||||
if pmm_FirstLine in ModifyMask then m.FirstLine:=ParaMetric.FirstLine;
|
if pmm_FirstLine in ModifyMask then m.FirstLine:=ParaMetric.FirstLine;
|
||||||
|
Reference in New Issue
Block a user