ide: drop files: invalidate file cache

This commit is contained in:
mattias 2025-02-20 09:52:05 +01:00
parent 20d97cb590
commit d26619895d
5 changed files with 18 additions and 5 deletions

View File

@ -5890,6 +5890,11 @@ var
begin begin
//DebugLn(['TMainIDE.DoDropFiles: ',length(Filenames), ' files, WindowIndex=', WindowIndex]); //DebugLn(['TMainIDE.DoDropFiles: ',length(Filenames), ' files, WindowIndex=', WindowIndex]);
if Length(FileNames) = 0 then exit; if Length(FileNames) = 0 then exit;
// the Drop event comes before the Application activate event or not at all
// => invalidate file state
InvalidateFileStateCache;
FileList := TStringList.Create; FileList := TStringList.Create;
FileList.AddStrings(FileNames); FileList.AddStrings(FileNames);
try try

View File

@ -414,7 +414,7 @@ implementation
procedure TMainIDEBar.MainIDEBarDropFiles(Sender: TObject; procedure TMainIDEBar.MainIDEBarDropFiles(Sender: TObject;
const FileNames: array of String); const FileNames: array of String);
begin begin
// the Drop event comes before the Application activate event // the Drop event comes before the Application activate event or not at all
// => invalidate file state // => invalidate file state
InvalidateFileStateCache; InvalidateFileStateCache;
LazarusIDE.DoDropFiles(Sender,FileNames); LazarusIDE.DoDropFiles(Sender,FileNames);

View File

@ -895,6 +895,11 @@ begin
debugln(['TProjectInspectorForm.FormDropFiles ',length(FileNames)]); debugln(['TProjectInspectorForm.FormDropFiles ',length(FileNames)]);
{$ENDIF} {$ENDIF}
if length(FileNames)=0 then exit; if length(FileNames)=0 then exit;
// the Drop event comes before the Application activate event or not at all
// => invalidate file state
InvalidateFileStateCache;
BeginUpdate; BeginUpdate;
try try
for i:=0 to high(Filenames) do for i:=0 to high(Filenames) do

View File

@ -392,6 +392,10 @@ var
begin begin
if length(FileNames) = 1 then // only one file if length(FileNames) = 1 then // only one file
begin begin
// the Drop event comes before the Application activate event or not at all
// => invalidate file state
InvalidateFileStateCache;
lFilename := CleanAndExpandFilename(FileNames[0]); lFilename := CleanAndExpandFilename(FileNames[0]);
LoadPackageListFromFile(lFilename); LoadPackageListFromFile(lFilename);
end; end;

View File

@ -1505,7 +1505,6 @@ end;
procedure TPackageEditorForm.FormDropFiles(Sender: TObject; procedure TPackageEditorForm.FormDropFiles(Sender: TObject;
const FileNames: array of String); const FileNames: array of String);
var var
i: Integer;
Files: TStringList; Files: TStringList;
begin begin
{$IFDEF VerbosePkgEditDrag} {$IFDEF VerbosePkgEditDrag}
@ -1514,13 +1513,13 @@ begin
if length(FileNames)=0 then exit; if length(FileNames)=0 then exit;
//debugln(['TPackageEditorForm.FormDropFiles ']); //debugln(['TPackageEditorForm.FormDropFiles ']);
// the Drop does not always trigger an application activate event -> invalidate here // the Drop event comes before the Application activate event or not at all
// => invalidate file state
InvalidateFileStateCache; InvalidateFileStateCache;
Files:=TStringList.Create; Files:=TStringList.Create;
try try
for i:=0 to high(Filenames) do Files.AddStrings(FileNames);
Files.Add(FileNames[i]);
AddUserFiles(Files); AddUserFiles(Files);
finally finally
Files.Free; Files.Free;