mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 09:38:13 +02:00
codetools: fixed removing first unit from second line
git-svn-id: trunk@42859 -
This commit is contained in:
parent
b05183547c
commit
0e785800e1
@ -1106,21 +1106,32 @@ begin
|
||||
if AtomIsChar(';') then begin
|
||||
// last unit in uses section -> delete whole uses section
|
||||
StartPos:=FindLineEndOrCodeInFrontOfPosition(UsesNode.StartPos,true,true);
|
||||
if not SourceChangeCache.Replace(gtNone,gtNone,
|
||||
StartPos,UsesNode.EndPos,'') then exit;
|
||||
EndPos:=UsesNode.EndPos;
|
||||
end else begin
|
||||
// not last unit -> delete with comma behind
|
||||
EndPos:=FindLineEndOrCodeAfterPosition(CurPos.EndPos);
|
||||
if (EndPos>SrcLen) or (Src[EndPos] in [#10,#13]) then
|
||||
StartPos:=FindLineEndOrCodeInFrontOfPosition(StartPos);// delete space in front or even the empty line
|
||||
if not SourceChangeCache.Replace(gtNone,gtNone,
|
||||
StartPos,EndPos,'') then exit;
|
||||
end;
|
||||
end else begin
|
||||
// not first unit in uses section -> delete with comma in front
|
||||
if not SourceChangeCache.Replace(gtNone,gtNone,
|
||||
EndPos,CurPos.StartPos,'') then exit;
|
||||
// not first unit in uses section
|
||||
if AtomIsChar(';') then begin
|
||||
// last unit -> delete with comma in front
|
||||
StartPos:=EndPos;
|
||||
EndPos:=CurPos.StartPos;
|
||||
end else if PositionsInSameLine(Src,EndPos,StartPos) then begin
|
||||
// not first unit in line -> delete with comma in front
|
||||
StartPos:=EndPos;
|
||||
EndPos:=CurPos.StartPos;
|
||||
end else begin
|
||||
// first unit in line -> delete with comma behind
|
||||
EndPos:=FindLineEndOrCodeAfterPosition(CurPos.EndPos);
|
||||
if (EndPos>SrcLen) or (Src[EndPos] in [#10,#13]) then
|
||||
StartPos:=FindLineEndOrCodeInFrontOfPosition(StartPos);// delete space in front or even the empty line
|
||||
end;
|
||||
end;
|
||||
if not SourceChangeCache.Replace(gtNone,gtNone,StartPos,EndPos,'') then
|
||||
exit;
|
||||
if not SourceChangeCache.Apply then exit;
|
||||
Result:=true;
|
||||
exit;
|
||||
|
Loading…
Reference in New Issue
Block a user