mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-04 18:37:26 +01:00
SynEdit: Fixed a rare issue with wrongly placed caret after overwriting the selection.
git-svn-id: trunk@40678 -
This commit is contained in:
parent
4c539b83a7
commit
0493e2f195
@ -222,6 +222,7 @@ type
|
||||
public
|
||||
constructor Create;
|
||||
procedure AssignFrom(Src: TSynEditBaseCaret);
|
||||
procedure Invalidate; // force to 1,1
|
||||
|
||||
function IsAtLineChar(aPoint: TPoint): Boolean;
|
||||
function IsAtLineByte(aPoint: TPoint; aByteOffset: Integer = -1): Boolean;
|
||||
@ -560,6 +561,14 @@ begin
|
||||
SetLines(Src.FLines);
|
||||
end;
|
||||
|
||||
procedure TSynEditBaseCaret.Invalidate;
|
||||
begin
|
||||
FLinePos := 1;
|
||||
FCharPos := 1;
|
||||
FBytePos := 1;
|
||||
FFlags := [];
|
||||
end;
|
||||
|
||||
function TSynEditBaseCaret.IsAtLineChar(aPoint: TPoint): Boolean;
|
||||
begin
|
||||
ValidateCharPos;
|
||||
@ -1349,6 +1358,7 @@ begin
|
||||
// Calculate the byte positions for each line
|
||||
SetLength(Col, Last - First + 1);
|
||||
SetLength(Len, Last - First + 1);
|
||||
FInternalCaret.Invalidate;
|
||||
FInternalCaret.LineBytePos := FirstLineBytePos;
|
||||
C1 := FInternalCaret.CharPos;
|
||||
FInternalCaret.LineBytePos := LastLineBytePos;
|
||||
@ -1768,6 +1778,7 @@ begin
|
||||
// BB is lower than BE
|
||||
BB := FirstLineBytePos;
|
||||
BE := LastLineBytePos;
|
||||
FInternalCaret.Invalidate;
|
||||
if SelAvail then begin
|
||||
if FActiveSelectionMode = smLine then begin
|
||||
BB.X := 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user