From 962f05f66559ce6e16182d22fc3e356abc10c7e2 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 28 Sep 2021 00:14:03 +0200 Subject: [PATCH] IDE, SourceEditor: TopLineInfoHint, reduce amount of memory re-allocs (cherry picked from commit 0f830698c0217cfa242d0cb134e94764c8358351) --- ide/sourcesyneditor.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ide/sourcesyneditor.pas b/ide/sourcesyneditor.pas index fac4ac0cba..fce78a4707 100644 --- a/ide/sourcesyneditor.pas +++ b/ide/sourcesyneditor.pas @@ -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;