mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 06:37:20 +01:00
SynEdit, fixed clearing non persistent block, if caret moves to other end of block
git-svn-id: trunk@20979 -
This commit is contained in:
parent
df0ac93df3
commit
27a85b3e3b
@ -3979,7 +3979,7 @@ end;
|
||||
procedure TCustomSynEdit.SetTopLine(Value: Integer);
|
||||
var
|
||||
Delta: Integer;
|
||||
OldTopView: LongInt;
|
||||
OldTopView: Integer;
|
||||
begin
|
||||
if fPaintLock > 0 then begin
|
||||
// defer scrolling, to minimize any possible flicker
|
||||
@ -5481,16 +5481,20 @@ begin
|
||||
ecLeft, ecSelLeft, ecColSelLeft:
|
||||
begin
|
||||
if (eoCaretSkipsSelection in Options2) and (Command=ecLeft)
|
||||
and SelAvail and FCaret.IsAtLineByte(FBlockSelection.LastLineBytePos) then
|
||||
FCaret.LineBytePos := FBlockSelection.FirstLineBytePos
|
||||
and SelAvail and FCaret.IsAtLineByte(FBlockSelection.LastLineBytePos) then begin
|
||||
FBlockSelection.IgnoreNextCaretMove;
|
||||
FCaret.LineBytePos := FBlockSelection.FirstLineBytePos;
|
||||
end
|
||||
else
|
||||
MoveCaretHorz(-1);
|
||||
end;
|
||||
ecRight, ecSelRight, ecColSelRight:
|
||||
begin
|
||||
if (eoCaretSkipsSelection in Options2) and (Command=ecRight)
|
||||
and SelAvail and FCaret.IsAtLineByte(FBlockSelection.FirstLineBytePos) then
|
||||
FCaret.LineBytePos := FBlockSelection.LastLineBytePos
|
||||
and SelAvail and FCaret.IsAtLineByte(FBlockSelection.FirstLineBytePos) then begin
|
||||
FBlockSelection.IgnoreNextCaretMove;
|
||||
FCaret.LineBytePos := FBlockSelection.LastLineBytePos;
|
||||
end
|
||||
else
|
||||
MoveCaretHorz(1);
|
||||
end;
|
||||
|
||||
@ -88,6 +88,7 @@ type
|
||||
FEndBytePos: Integer; // 1 based
|
||||
FPersistent: Boolean;
|
||||
FPersistentLock: Integer;
|
||||
FIgnoreNextCaretMove: Boolean;
|
||||
(* On any modification, remember the position of the caret.
|
||||
If it gets moved from there to either end of the block, this should be ignored
|
||||
This happens, if Block and caret are adjusted directly
|
||||
@ -124,6 +125,7 @@ type
|
||||
function SelCanContinue(ACaret: TSynEditCaret): Boolean;
|
||||
function IsBackwardSel: Boolean; // SelStart < SelEnd ?
|
||||
procedure SortSelectionPoints;
|
||||
procedure IgnoreNextCaretMove;
|
||||
procedure IncPersistentLock;
|
||||
procedure DecPersistentLock;
|
||||
procedure Clear;
|
||||
@ -734,7 +736,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure TSynEditSelection.DoCaretChanged(Sender: TObject);
|
||||
var
|
||||
Ignore: Boolean;
|
||||
begin
|
||||
Ignore := FIgnoreNextCaretMove;
|
||||
FIgnoreNextCaretMove := False;
|
||||
if Ignore then
|
||||
exit;
|
||||
|
||||
if (FCaret.IsAtLineByte(StartLineBytePos) or
|
||||
FCaret.IsAtLineByte(EndLineBytePos)) and
|
||||
FCaret.WasAtLineChar(FLastCarePos)
|
||||
@ -757,15 +766,9 @@ begin
|
||||
exit;
|
||||
end;
|
||||
|
||||
|
||||
if FPersistent or (FPersistentLock > 0) then
|
||||
exit;
|
||||
|
||||
if FCaret.IsAtLineByte(StartLineBytePos) or
|
||||
FCaret.IsAtLineByte(EndLineBytePos)
|
||||
then
|
||||
exit;
|
||||
|
||||
StartLineBytePos := FCaret.LineBytePos;
|
||||
end;
|
||||
|
||||
@ -1315,6 +1318,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSynEditSelection.IgnoreNextCaretMove;
|
||||
begin
|
||||
FIgnoreNextCaretMove := True;
|
||||
end;
|
||||
|
||||
procedure TSynEditSelection.IncPersistentLock;
|
||||
begin
|
||||
inc(FPersistentLock)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user