fixed setting unitname for non units on save as

git-svn-id: trunk@8641 -
This commit is contained in:
mattias 2006-01-28 11:33:30 +00:00
parent 4672fc5ab0
commit 2e6513b9ed
2 changed files with 18 additions and 11 deletions

View File

@ -3485,10 +3485,12 @@ begin
NewShortFilename:=ExtractFilenameOnly(NewFilename);
// use as unitname the NewShortFilename, but with the case of the
// original unitname. e.g. 'unit12.pas' becomes 'Unit12.pas'
if Descriptor.IsPascalUnit then begin
NewUnitName:=ChompEndNumber(NewUnitName);
NewUnitName:=NewUnitName+copy(NewShortFilename,length(NewUnitName)+1,
length(NewShortFilename));
end;
end;
//debugln('TMainIDE.CreateNewCodeBuffer NewFilename=',NewFilename,' NewUnitName=',NewUnitName);
if FilenameIsPascalUnit(NewFilename) then begin

View File

@ -813,8 +813,9 @@ begin
Result:=mrOk;
end;
until Result<>mrRetry;
if ReadUnitName then
if ReadUnitName then begin
fUnitName:=CodeToolBoss.GetSourceName(fSource,false);
end;
Result:=mrOk;
end;
@ -829,6 +830,7 @@ begin
NewUnitName:=CodeToolBoss.GetSourceName(fSource,false);
if NewUnitName='' then begin
// unable to parse the source
if FilenameIsPascalSource(Filename) then begin
// use default: the filename
NewUnitName:=ExtractFileNameOnly(Filename);
if CompareText(NewUnitName,fUnitName)=0 then begin
@ -836,8 +838,10 @@ begin
exit;
end;
end;
if NewUnitName<>'' then
end;
if NewUnitName<>'' then begin
fUnitName:=NewUnitName;
end;
end;
function TUnitInfo.CreateUnitName: string;
@ -849,8 +853,9 @@ end;
procedure TUnitInfo.ImproveUnitNameCache(const NewUnitName: string);
begin
if (fUnitName='') or (CompareText(fUnitName,NewUnitName)=0) then
if (fUnitName='') or (CompareText(fUnitName,NewUnitName)=0) then begin
fUnitName:=NewUnitName;
end;
end;
{------------------------------------------------------------------------------