SourceEditor: fixed updating top-line-hint (invalidate/repaint)

This commit is contained in:
Martin 2022-04-01 15:01:09 +02:00
parent 5b23421c5d
commit 9f3623bb45

View File

@ -76,6 +76,7 @@ type
private private
FLineMapCount: integer; FLineMapCount: integer;
FLineMap: array of integer; FLineMap: array of integer;
FSkipTextToView: Boolean;
function GetLineMap(Index: Integer): Integer; function GetLineMap(Index: Integer): Integer;
procedure SetLineMap(Index: Integer; AValue: Integer); procedure SetLineMap(Index: Integer; AValue: Integer);
procedure SetLineMapCount(AValue: integer); procedure SetLineMapCount(AValue: integer);
@ -1222,6 +1223,11 @@ var
i: Integer; i: Integer;
r: TLineRange; r: TLineRange;
begin begin
if FSkipTextToView then begin
Result.Top := AIndex;
Result.Bottom := AIndex;
exit;
end;
Result.Top := -1; Result.Top := -1;
Result.Bottom := -1; Result.Bottom := -1;
r := inherited TextToViewIndex(AIndex); r := inherited TextToViewIndex(AIndex);
@ -1554,11 +1560,13 @@ begin
Invalidate; // TODO: move to PaintArea Invalidate; // TODO: move to PaintArea
end; end;
FTopInfoDisplay.FSkipTextToView := True;
for i := 0 to ListCnt - 1 do begin for i := 0 to ListCnt - 1 do begin
if FTopInfoDisplay.LineMap[ListCnt-1-i] <> InfList[i].LineIndex then if FTopInfoDisplay.LineMap[ListCnt-1-i] <> InfList[i].LineIndex then
TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.InvalidateLines(ListCnt-1-i, ListCnt-1-i); TSourceLazSynSurfaceManager(FPaintArea).ExtraManager.InvalidateLines(ListCnt-1-i, ListCnt-1-i);
FTopInfoDisplay.LineMap[ListCnt-1-i] := InfList[i].LineIndex; FTopInfoDisplay.LineMap[ListCnt-1-i] := InfList[i].LineIndex;
end; end;
FTopInfoDisplay.FSkipTextToView := False;
finally finally
FSrcSynCaretChangedLock := False; FSrcSynCaretChangedLock := False;