IDE, SourceEditor: TopLineInfoHint, reduce amount of memory re-allocs

(cherry picked from commit 0f830698c0)
This commit is contained in:
Martin 2021-09-28 00:14:03 +02:00
parent 2906c4f8d1
commit 962f05f665

View File

@ -1201,7 +1201,8 @@ procedure TSourceLazSynTopInfoView.SetLineMapCount(AValue: integer);
begin
if FLineMapCount = AValue then Exit;
FLineMapCount := AValue;
SetLength(FLineMap, AValue);
if (length(FLineMap) < AValue) or (length(FLineMap) > (AValue+1) * 2) then
SetLength(FLineMap, AValue);
end;
procedure TSourceLazSynTopInfoView.SetHighlighterTokensLine(ALine: TLineIdx;
@ -1239,7 +1240,7 @@ end;
constructor TSourceLazSynTopInfoView.Create;
begin
LineMapCount := 0;
ClearLineMap;
end;
procedure TSourceLazSynTopInfoView.ClearLineMap;