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