SynEdit: Improve boundary checks in MouseMove (while drag or select). Remove some obsolete checks.

This commit is contained in:
Martin 2023-03-24 23:26:25 +01:00
parent bc2d68125a
commit ebf6768e85

View File

@ -3855,6 +3855,13 @@ begin
//DebugLn(' TCustomSynEdit.MouseMove CAPTURE Mouse=',dbgs(X),',',dbgs(Y),' Caret=',dbgs(CaretXY),', BlockBegin=',dbgs(BlockBegin),' BlockEnd=',dbgs(BlockEnd)); //DebugLn(' TCustomSynEdit.MouseMove CAPTURE Mouse=',dbgs(X),',',dbgs(Y),' Caret=',dbgs(CaretXY),', BlockBegin=',dbgs(BlockBegin),' BlockEnd=',dbgs(BlockEnd));
if sfIsDragging in fStateFlags then if sfIsDragging in fStateFlags then
FBlockSelection.IncPersistentLock; FBlockSelection.IncPersistentLock;
// compare to Bounds => Padding area does not scroll
if (X >= FTextArea.Bounds.Left) and
(X < FTextArea.Bounds.Right) and
(Y >= FTextArea.Bounds.Top) and
(Y < FTextArea.Bounds.Bottom)
then begin
FInternalCaret.AssignFrom(FCaret); FInternalCaret.AssignFrom(FCaret);
FInternalCaret.LineCharPos := PixelsToRowColumn(Point(X,Y)); FInternalCaret.LineCharPos := PixelsToRowColumn(Point(X,Y));
@ -3896,12 +3903,6 @@ begin
FInternalCaret.LineBytePos := p1; FInternalCaret.LineBytePos := p1;
end; end;
// compare to Bounds => Padding area does not scroll
if ( (X >= FTextArea.Bounds.Left) or (LeftChar <= 1) ) and
( (X < FTextArea.Bounds.Right) or (LeftChar >= CurrentMaxLeftChar) ) and
( (Y >= FTextArea.Bounds.Top) or (TopView <= 1) ) and
( (Y < FTextArea.Bounds.Bottom) or (TopView >= CurrentMaxTopView) )
then begin
if (sfMouseSelecting in fStateFlags) and not FInternalCaret.IsAtPos(FCaret) then if (sfMouseSelecting in fStateFlags) and not FInternalCaret.IsAtPos(FCaret) then
Include(fStateFlags, sfMouseDoneSelecting); Include(fStateFlags, sfMouseDoneSelecting);
FBlockSelection.StickyAutoExtend := False; FBlockSelection.StickyAutoExtend := False;