mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 11:30:28 +02:00
codetools: fixed complete event assignment keeping spaces after assign operator
This commit is contained in:
parent
87bcd888ad
commit
57c88852ab
@ -2155,14 +2155,30 @@ function TCodeCompletionCodeTool.CompleteEventAssignment(CleanCursorPos,
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
// add new event name as right value of assignment
|
// add new event name as right value of assignment
|
||||||
// add address operator @ if needed or user provided it himself
|
// add address operator @ if needed or user provided it himself
|
||||||
|
|
||||||
|
if UserEventAtom.StartPos>0 then begin
|
||||||
|
end else begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
RValue:=AnEventName+';';
|
RValue:=AnEventName+';';
|
||||||
if (AddrOperatorPos>0)
|
if (AddrOperatorPos>0)
|
||||||
or ((Scanner.PascalCompiler=pcFPC) and (Scanner.CompilerMode<>cmDelphi))
|
or (Scanner.CompilerMode in [cmDelphi,cmDELPHIUNICODE])
|
||||||
then
|
then
|
||||||
RValue:='@'+RValue;
|
RValue:='@'+RValue;
|
||||||
|
if (AddrOperatorPos>0) or (UserEventAtom.StartPos>0) then begin
|
||||||
|
// left := |SomeName -> keep assignment and space behind
|
||||||
|
StartInsertPos:=AddrOperatorPos;
|
||||||
|
if StartInsertPos<1 then
|
||||||
|
StartInsertPos:=UserEventAtom.StartPos;
|
||||||
|
end else begin
|
||||||
|
// left :=|
|
||||||
RValue:=':='+RValue;
|
RValue:=':='+RValue;
|
||||||
RValue:=SourceChangeCache.BeautifyCodeOptions.BeautifyStatement(RValue,0);
|
|
||||||
StartInsertPos:=AssignmentOperator;
|
StartInsertPos:=AssignmentOperator;
|
||||||
|
end;
|
||||||
|
|
||||||
|
RValue:=SourceChangeCache.BeautifyCodeOptions.BeautifyStatement(RValue,0);
|
||||||
|
RValue:=TrimLeft(RValue);
|
||||||
EndInsertPos:=SemicolonPos+1;
|
EndInsertPos:=SemicolonPos+1;
|
||||||
if EndInsertPos<1 then
|
if EndInsertPos<1 then
|
||||||
EndInsertPos:=UserEventAtom.EndPos;
|
EndInsertPos:=UserEventAtom.EndPos;
|
||||||
|
Loading…
Reference in New Issue
Block a user