SynEdit: fix invalidate gutter-lines, if caret Viewed-Y changes

This commit is contained in:
Martin 2025-01-24 11:25:33 +01:00
parent ce7acbe6cf
commit 2a874e1c87
2 changed files with 20 additions and 1 deletions

View File

@ -4864,8 +4864,11 @@ begin
fStateFlags := fStateFlags - [sfExplicitTopLine, sfExplicitLeftChar];
if FCaret.OldCharPos <> FCaret.CharPos then
Include(fStatusChanges, scCaretX);
if FCaret.OldLinePos <> FCaret.LinePos then begin
if FCaret.OldLinePos <> FCaret.LinePos then
Include(fStatusChanges, scCaretY);
if (FCaret.OldViewedLineCharPos.Y < 0) or
(FCaret.OldViewedLineCharPos.Y <> FCaret.ViewedLineCharPos.y)
then begin
InvalidateGutterLines(FCaret.OldLinePos, FCaret.OldLinePos);
InvalidateGutterLines(FCaret.LinePos, FCaret.LinePos);
end;

View File

@ -332,6 +332,7 @@ type
FOldLinePos: Integer; // 1 based
FOldCharPos: Integer; // 1 based
FOldViewedLineCharPos: TPoint;
FAdjustToNextChar: Boolean;
FMaxLeftChar: TMaxLeftCharFunc;
@ -389,6 +390,7 @@ type
property OldLineCharPos: TPoint read GetOldLineCharPos;
property OldLineBytePos: TPoint read GetOldLineBytePos;
property OldFullLogicalPos: TLogCaretPoint read GetOldFullLogicalPos;
property OldViewedLineCharPos: TPoint read FOldViewedLineCharPos;
property AdjustToNextChar: Boolean read FAdjustToNextChar write FAdjustToNextChar; deprecated;
property SkipTabs: Boolean read FSkipTabs write SetSkipTabs;
@ -1108,6 +1110,13 @@ begin
//ValidateBytePos;
FOldCharPos := FCharPos;
FOldLinePos := FLinePos;
if scViewedPosValid in FFlags then begin
FOldViewedLineCharPos := FViewedLineCharPos;
end
else begin
FOldViewedLineCharPos.x := -1;
FOldViewedLineCharPos.y := -1;
end;
end;
procedure TSynEditCaret.DoUnlock;
@ -1125,6 +1134,13 @@ begin
FTouched := False;
FOldCharPos := FCharPos;
FOldLinePos := FLinePos;
if scViewedPosValid in FFlags then begin
FOldViewedLineCharPos := FViewedLineCharPos;
end
else begin
FOldViewedLineCharPos.x := -1;
FOldViewedLineCharPos.y := -1;
end;
end;
procedure TSynEditCaret.SetLines(const AValue: TSynEditStringsLinked);