mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-15 03:08:56 +02:00
fixed synedit undo for middle button inserting primary selection
git-svn-id: trunk@7536 -
This commit is contained in:
parent
c2b3055202
commit
16bf8eb0b8
@ -2136,6 +2136,7 @@ begin
|
|||||||
if Button=mbMiddle then begin
|
if Button=mbMiddle then begin
|
||||||
if ssDouble in Shift then Exit;
|
if ssDouble in Shift then Exit;
|
||||||
PrimarySelText:=PrimarySelection.AsText;
|
PrimarySelText:=PrimarySelection.AsText;
|
||||||
|
debugln('TCustomSynEdit.MouseDown PrimarySelText="',DbgStr(PrimarySelText),'"');
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
inherited MouseDown(Button, Shift, X, Y);
|
inherited MouseDown(Button, Shift, X, Y);
|
||||||
@ -2187,19 +2188,13 @@ begin
|
|||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
if (Button=mbMiddle)
|
if (Button=mbMiddle)
|
||||||
and ([sfDblClicked,sfTripleClicked,sfQuadClicked]*fStateFlags=[])
|
and ([sfDblClicked,sfTripleClicked,sfQuadClicked]*fStateFlags=[])
|
||||||
|
and ((PrimarySelText<>'') or SelAvail)
|
||||||
then begin
|
then begin
|
||||||
if SelAvail then begin
|
fBlockBegin := LogCaretXY;
|
||||||
fUndoList.AddChange(crDelete, fBlockBegin, fBlockEnd, SelText,
|
fBlockEnd := LogCaretXY;
|
||||||
SelectionMode);
|
//debugln('TCustomSynEdit.MouseDown Old SelText="',DbgStr(SelText),'" fBlockBegin=',dbgs(fBlockBegin),' fBlockEnd=',dbgs(fBlockEnd),' LogCaretXY=',dbgs(LogCaretXY));
|
||||||
end;
|
|
||||||
StartOfBlock := minPoint(fBlockBegin, fBlockEnd);
|
|
||||||
EndOfBlock := maxPoint(fBlockBegin, fBlockEnd);
|
|
||||||
fBlockBegin := StartOfBlock;
|
|
||||||
fBlockEnd := EndOfBlock;
|
|
||||||
LockUndo;
|
|
||||||
SelText:=PrimarySelText;
|
SelText:=PrimarySelText;
|
||||||
UnlockUndo;
|
//debugln('TCustomSynEdit.MouseDown New SelText="',DbgStr(SelText),'" fBlockBegin=',dbgs(fBlockBegin),' fBlockEnd=',dbgs(fBlockEnd),' LogCaretXY=',dbgs(LogCaretXY));
|
||||||
fUndoList.AddChange(crPaste, StartOfBlock, BlockEnd, SelText, smNormal);
|
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
@ -8482,7 +8477,8 @@ begin
|
|||||||
LockUndo;
|
LockUndo;
|
||||||
SetSelText(Value);
|
SetSelText(Value);
|
||||||
UnlockUndo;
|
UnlockUndo;
|
||||||
fUndoList.AddChange(crInsert, StartOfBlock, BlockEnd, SelText, smNormal);
|
fUndoList.AddChange(crInsert, StartOfBlock, BlockEnd,
|
||||||
|
{$IFDEF SYN_LAZARUS}''{$ELSE}SelText{$ENDIF}, smNormal);
|
||||||
finally
|
finally
|
||||||
EndUndoBlock;
|
EndUndoBlock;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user