mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-04 06:20:29 +01:00
codetools: fixed boss.loadfile to not load when autorevert is disabled
git-svn-id: trunk@16808 -
This commit is contained in:
parent
4dea886e4b
commit
f30a307736
@ -922,12 +922,11 @@ end;
|
||||
procedure TCodeBuffer.SetIsDeleted(const NewValue: boolean);
|
||||
begin
|
||||
if FIsDeleted=NewValue then exit;
|
||||
//debugln(['TCodeBuffer.SetIsDeleted ',Filename,' ',NewValue]);
|
||||
debugln(['TCodeBuffer.SetIsDeleted ',Filename,' ',NewValue]);
|
||||
FIsDeleted:=NewValue;
|
||||
if FIsDeleted then begin
|
||||
Clear;
|
||||
FIsDeleted:=true;
|
||||
FLoadDateValid:=false;
|
||||
//DebugLn(['TCodeBuffer.SetIsDeleted ',Filename,' ',FileNeedsUpdate]);
|
||||
end;
|
||||
end;
|
||||
@ -975,17 +974,17 @@ begin
|
||||
end;
|
||||
|
||||
function TCodeBuffer.FileNeedsUpdate: boolean;
|
||||
// file needs update, if file is not modified and file on disk has changed
|
||||
// file needs update (to be loaded), if file is not modified and file on disk has changed
|
||||
begin
|
||||
if Modified then exit(false);
|
||||
if LoadDateValid then
|
||||
Result:=(not Modified) and (FFileChangeStep=ChangeStep)
|
||||
and (FileDateOnDisk<>LoadDate)
|
||||
Result:=(FFileChangeStep=ChangeStep) and (FileDateOnDisk<>LoadDate)
|
||||
else
|
||||
Result:=true;
|
||||
end;
|
||||
|
||||
function TCodeBuffer.FileOnDiskNeedsUpdate: boolean;
|
||||
// file on disk needs update, if memory is modified or file does not exist
|
||||
// file on disk needs update (to be saved), if memory is modified or file does not exist
|
||||
begin
|
||||
if LoadDateValid then
|
||||
Result:=Modified or (FFileChangeStep<>ChangeStep)
|
||||
|
||||
@ -959,12 +959,19 @@ begin
|
||||
{$IFDEF CTDEBUG}
|
||||
DebugLn('>>>>>> [TCodeToolManager.LoadFile] ',ExpandedFilename,' Update=',dbgs(UpdateFromDisk),' Revert=',dbgs(Revert));
|
||||
{$ENDIF}
|
||||
if (not UpdateFromDisk) and (not Revert) then begin
|
||||
Result:=SourceCache.FindFile(ExpandedFilename);
|
||||
if (Result<>nil) and (not Result.IsDeleted) then exit;
|
||||
end;
|
||||
Result:=SourceCache.LoadFile(ExpandedFilename);
|
||||
if Result<>nil then begin
|
||||
if Revert then
|
||||
Result.Revert
|
||||
else if UpdateFromDisk then
|
||||
else if UpdateFromDisk and Result.AutoRevertFromDisk
|
||||
and Result.FileNeedsUpdate then begin
|
||||
//debugln(['TCodeToolManager.LoadFile ',ExpandedFilename,' AutoRevert=',Result.AutoRevertFromDisk,' Modified=',Result.Modified,' NeedLoad=',Result.FileNeedsUpdate]);
|
||||
Result.Reload;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
16
ide/main.pp
16
ide/main.pp
@ -7289,6 +7289,14 @@ begin
|
||||
Result:=mrOk;
|
||||
end;
|
||||
|
||||
// close form soft (keep it if used by another component)
|
||||
CloseUnitComponent(ActiveUnitInfo,[]);
|
||||
|
||||
// close source editor
|
||||
SourceNoteBook.CloseFile(PageIndex);
|
||||
MainIDEBar.itmFileClose.Enabled:=SourceNoteBook.Notebook<>nil;
|
||||
MainIDEBar.itmFileCloseAll.Enabled:=MainIDEBar.itmFileClose.Enabled;
|
||||
|
||||
// free sources
|
||||
if (ActiveUnitInfo.Source<>nil) then begin
|
||||
if (Project1.MainUnitInfo=ActiveUnitInfo)
|
||||
@ -7299,14 +7307,6 @@ begin
|
||||
ActiveUnitInfo.Source.IsDeleted:=true;
|
||||
end;
|
||||
|
||||
// close form soft (keep it if used by another component)
|
||||
CloseUnitComponent(ActiveUnitInfo,[]);
|
||||
|
||||
// close source editor
|
||||
SourceNoteBook.CloseFile(PageIndex);
|
||||
MainIDEBar.itmFileClose.Enabled:=SourceNoteBook.Notebook<>nil;
|
||||
MainIDEBar.itmFileCloseAll.Enabled:=MainIDEBar.itmFileClose.Enabled;
|
||||
|
||||
// close file in project
|
||||
Project1.CloseEditorIndex(ActiveUnitInfo.EditorIndex);
|
||||
ActiveUnitInfo.Loaded:=false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user