mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 21:30:04 +02:00
MG: fixed editing empty resources
git-svn-id: trunk@3250 -
This commit is contained in:
parent
674a9771d9
commit
b2bee3d6e7
components/codetools
@ -1470,6 +1470,7 @@ begin
|
||||
case Source[Result] of
|
||||
'}',')':
|
||||
if not ReadComment(Result) then exit;
|
||||
|
||||
#10,#13:
|
||||
begin
|
||||
// line end in code found
|
||||
@ -1499,13 +1500,14 @@ begin
|
||||
end;
|
||||
Result:=TestPos;
|
||||
end;
|
||||
|
||||
' ',';',',':
|
||||
dec(Result);
|
||||
|
||||
else
|
||||
begin
|
||||
if (Source[Result]<=' ') or (Source[Result] in [';',',']) then
|
||||
dec(Result)
|
||||
else
|
||||
exit;
|
||||
end;
|
||||
// code found
|
||||
inc(Result);
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
if Result<SrcStart then Result:=SrcStart;
|
||||
|
@ -1192,7 +1192,8 @@ begin
|
||||
{$ENDIF}
|
||||
try
|
||||
Result:=GetResourceTool.AddLazarusResourceHeaderComment(Code,
|
||||
'{ '+CommentText+' }'+SourceChangeCache.BeautifyCodeOptions.LineEnd);
|
||||
'{ '+CommentText+' }'+SourceChangeCache.BeautifyCodeOptions.LineEnd
|
||||
+SourceChangeCache.BeautifyCodeOptions.LineEnd);
|
||||
except
|
||||
on e: Exception do HandleException(e);
|
||||
end;
|
||||
|
@ -186,13 +186,14 @@ begin
|
||||
// not found -> add at end of file
|
||||
InsertAtom.StartPos:=ResourceCode.SourceLength+1;
|
||||
InsertAtom.EndPos:=ResourceCode.SourceLength+1;
|
||||
end else begin
|
||||
InsertAtom.StartPos:=BasicCodeTools.FindLineEndOrCodeInFrontOfPosition(Src,
|
||||
InsertAtom.StartPos,1,false,true);
|
||||
InsertAtom.EndPos:=BasicCodeTools.FindLineEndOrCodeAfterPosition(Src,
|
||||
InsertAtom.EndPos,SrcLen,false);
|
||||
end;
|
||||
InsertAtom.StartPos:=BasicCodeTools.FindLineEndOrCodeInFrontOfPosition(Src,
|
||||
InsertAtom.StartPos,1,false,true)+1;
|
||||
if CodeIsOnlySpace(Src,1,InsertAtom.StartPos-1) then
|
||||
InsertAtom.StartPos:=1;
|
||||
InsertAtom.EndPos:=BasicCodeTools.FindLineEndOrCodeAfterPosition(Src,
|
||||
InsertAtom.EndPos,SrcLen,false);
|
||||
if CodeIsOnlySpace(Src,InsertAtom.EndPos+1,SrcLen) then
|
||||
InsertAtom.EndPos:=SrcLen+1;
|
||||
|
||||
@ -248,7 +249,8 @@ begin
|
||||
CurResPos:=ResourcePositions[i];
|
||||
CurResPos.EndPos:=BasicCodeTools.FindLineEndOrCodeAfterPosition(Src,
|
||||
CurResPos.EndPos,SrcLen,false);
|
||||
ResourceCode.Delete(CurResPos.StartPos,CurResPos.EndPos-CurResPos.StartPos);
|
||||
ResourceCode.Delete(CurResPos.StartPos,
|
||||
CurResPos.EndPos-CurResPos.StartPos);
|
||||
end;
|
||||
if ResourcePositions.Count>0 then begin
|
||||
First:=ResourcePositions[0];
|
||||
|
Loading…
Reference in New Issue
Block a user