mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-10 15:18:14 +02:00
SynEdit: fix DragOver, don't reset caret to pos=1 if dragging over gutter or decoration, related to issue #40177
This commit is contained in:
parent
2a06079ae9
commit
bc2d68125a
@ -6336,23 +6336,32 @@ begin
|
|||||||
inherited;
|
inherited;
|
||||||
LastMouseCaret:=Point(-1,-1);
|
LastMouseCaret:=Point(-1,-1);
|
||||||
if (eoAcceptDragDropEditing in FOptions2) and (Source is TCustomSynEdit) then begin
|
if (eoAcceptDragDropEditing in FOptions2) and (Source is TCustomSynEdit) then begin
|
||||||
Accept := False;
|
Accept := (X >= FTextArea.Bounds.Left) and
|
||||||
if (not ReadOnly) and TCustomSynEdit(Source).SelAvail then
|
(X < FTextArea.Bounds.Right) and
|
||||||
|
(Y >= FTextArea.Bounds.Top) and
|
||||||
|
(Y < FTextArea.Bounds.Bottom);
|
||||||
|
|
||||||
|
if Accept and (not ReadOnly) and TCustomSynEdit(Source).SelAvail then
|
||||||
begin
|
begin
|
||||||
FBlockSelection.IncPersistentLock;
|
|
||||||
try
|
|
||||||
//if State = dsDragLeave then //restore prev caret position
|
//if State = dsDragLeave then //restore prev caret position
|
||||||
// ComputeCaret(FMouseDownX, FMouseDownY)
|
// ComputeCaret(FMouseDownX, FMouseDownY)
|
||||||
//else //position caret under the mouse cursor
|
//else //position caret under the mouse cursor
|
||||||
ComputeCaret(X, Y);
|
FInternalCaret.AssignFrom(FCaret);
|
||||||
|
FInternalCaret.LineCharPos := PixelsToRowColumn(Point(X,Y));
|
||||||
|
Accept := CheckDragDropAccecpt(FInternalCaret.LineBytePos, Source, DropMove);
|
||||||
|
|
||||||
|
if Accept then begin
|
||||||
|
FBlockSelection.IncPersistentLock;
|
||||||
|
try
|
||||||
|
FCaret.LineCharPos := FInternalCaret.LineCharPos;
|
||||||
|
finally
|
||||||
|
FBlockSelection.DecPersistentLock;
|
||||||
|
end;
|
||||||
|
|
||||||
Accept := CheckDragDropAccecpt(LogicalCaretXY, Source, DropMove);
|
|
||||||
if DropMove then
|
if DropMove then
|
||||||
DragCursor := crDrag
|
DragCursor := crDrag
|
||||||
else
|
else
|
||||||
DragCursor := crMultiDrag;
|
DragCursor := crMultiDrag;
|
||||||
finally
|
|
||||||
FBlockSelection.DecPersistentLock;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user