mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-26 03:48:15 +02:00
SynEdit: Fix calculation of "Viewed" block boundaries.
git-svn-id: trunk@63527 -
This commit is contained in:
parent
b1407efb6f
commit
fa075e2a66
@ -1772,14 +1772,19 @@ begin
|
|||||||
FEndLinePos := src.FEndLinePos; // 1 based
|
FEndLinePos := src.FEndLinePos; // 1 based
|
||||||
FEndBytePos := src.FEndBytePos; // 1 based
|
FEndBytePos := src.FEndBytePos; // 1 based
|
||||||
FPersistent := src.FPersistent;
|
FPersistent := src.FPersistent;
|
||||||
|
FFlags := FFLags - [sbViewedFirstPosValid, sbViewedLastPosValid];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSynEditSelection.AdjustAfterTrimming;
|
procedure TSynEditSelection.AdjustAfterTrimming;
|
||||||
begin
|
begin
|
||||||
if FStartBytePos > Length(FLines[FStartLinePos-1]) + 1 then
|
if FStartBytePos > Length(FLines[FStartLinePos-1]) + 1 then begin
|
||||||
FStartBytePos := Length(FLines[FStartLinePos-1]) + 1;
|
FStartBytePos := Length(FLines[FStartLinePos-1]) + 1;
|
||||||
if FEndBytePos > Length(FLines[FEndLinePos-1]) + 1 then
|
FFlags := FFLags - [sbViewedFirstPosValid];
|
||||||
|
end;
|
||||||
|
if FEndBytePos > Length(FLines[FEndLinePos-1]) + 1 then begin
|
||||||
FEndBytePos := Length(FLines[FEndLinePos-1]) + 1;
|
FEndBytePos := Length(FLines[FEndLinePos-1]) + 1;
|
||||||
|
FFlags := FFLags - [sbViewedLastPosValid];
|
||||||
|
end;
|
||||||
// Todo: Call ChangeNotification
|
// Todo: Call ChangeNotification
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1972,6 +1977,7 @@ procedure TSynEditSelection.DoCaretChanged(Sender: TObject);
|
|||||||
FAltStartBytePos := FStartBytePos;
|
FAltStartBytePos := FStartBytePos;
|
||||||
FStartLinePos := y;
|
FStartLinePos := y;
|
||||||
FStartBytePos := x;
|
FStartBytePos := x;
|
||||||
|
FFlags := FFLags - [sbViewedFirstPosValid];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure FixMinimumSelection;
|
procedure FixMinimumSelection;
|
||||||
@ -2045,11 +2051,15 @@ begin
|
|||||||
|
|
||||||
//AdjustAfterTrimming;
|
//AdjustAfterTrimming;
|
||||||
if (FStartLinePos >= i) and (FStartLinePos <= i2) then
|
if (FStartLinePos >= i) and (FStartLinePos <= i2) then
|
||||||
if FStartBytePos > Length(FLines[FStartLinePos-1]) + 1 then
|
if FStartBytePos > Length(FLines[FStartLinePos-1]) + 1 then begin
|
||||||
FStartBytePos := Length(FLines[FStartLinePos-1]) + 1;
|
FStartBytePos := Length(FLines[FStartLinePos-1]) + 1;
|
||||||
|
FFlags := FFLags - [sbViewedFirstPosValid];
|
||||||
|
end;
|
||||||
if (FEndLinePos >= i) and (FEndLinePos <= i2) then
|
if (FEndLinePos >= i) and (FEndLinePos <= i2) then
|
||||||
if FEndBytePos > Length(FLines[FEndLinePos-1]) + 1 then
|
if FEndBytePos > Length(FLines[FEndLinePos-1]) + 1 then begin
|
||||||
FEndBytePos := Length(FLines[FEndLinePos-1]) + 1;
|
FEndBytePos := Length(FLines[FEndLinePos-1]) + 1;
|
||||||
|
FFlags := FFLags - [sbViewedLastPosValid];
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2515,9 +2525,10 @@ begin
|
|||||||
FHide := False;
|
FHide := False;
|
||||||
FStartLinePos := Value.Y;
|
FStartLinePos := Value.Y;
|
||||||
FStartBytePos := Value.X;
|
FStartBytePos := Value.X;
|
||||||
|
|
||||||
FEndLinePos := Value.Y;
|
FEndLinePos := Value.Y;
|
||||||
FEndBytePos := Value.X;
|
FEndBytePos := Value.X;
|
||||||
|
FFlags := FFLags - [sbViewedFirstPosValid, sbViewedLastPosValid];
|
||||||
|
|
||||||
if FCaret <> nil then
|
if FCaret <> nil then
|
||||||
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
|
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
|
||||||
if WasAvail then
|
if WasAvail then
|
||||||
@ -2541,6 +2552,7 @@ begin
|
|||||||
|
|
||||||
FStartLinePos := Value.Y;
|
FStartLinePos := Value.Y;
|
||||||
FStartBytePos := Value.X;
|
FStartBytePos := Value.X;
|
||||||
|
FFlags := FFLags - [sbViewedFirstPosValid];
|
||||||
if FCaret <> nil then
|
if FCaret <> nil then
|
||||||
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
|
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
|
||||||
FOnChangeList.CallNotifyEvents(self);
|
FOnChangeList.CallNotifyEvents(self);
|
||||||
@ -2611,6 +2623,7 @@ begin
|
|||||||
FInvalidateLinesMethod(FEndLinePos, Value.Y);
|
FInvalidateLinesMethod(FEndLinePos, Value.Y);
|
||||||
FEndLinePos := Value.Y;
|
FEndLinePos := Value.Y;
|
||||||
FEndBytePos := Value.X;
|
FEndBytePos := Value.X;
|
||||||
|
FFlags := FFLags - [sbViewedLastPosValid];
|
||||||
if FCaret <> nil then
|
if FCaret <> nil then
|
||||||
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
|
FLastCarePos := Point(FCaret.OldCharPos, FCaret.OldLinePos);
|
||||||
FOnChangeList.CallNotifyEvents(self);
|
FOnChangeList.CallNotifyEvents(self);
|
||||||
@ -2853,6 +2866,7 @@ begin
|
|||||||
if IsBackwardSel xor AReverse then begin
|
if IsBackwardSel xor AReverse then begin
|
||||||
SwapInt(FStartLinePos, FEndLinePos);
|
SwapInt(FStartLinePos, FEndLinePos);
|
||||||
SwapInt(FStartBytePos, FEndBytePos);
|
SwapInt(FStartBytePos, FEndBytePos);
|
||||||
|
FFlags := FFLags - [sbViewedFirstPosValid, sbViewedLastPosValid];
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user