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
//DebugLn(['TMainIDE.DoDropFiles: ',length(Filenames), ' files, WindowIndex=', WindowIndex]);
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.AddStrings(FileNames);
try

View File

@ -414,7 +414,7 @@ implementation
procedure TMainIDEBar.MainIDEBarDropFiles(Sender: TObject;
const FileNames: array of String);
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
InvalidateFileStateCache;
LazarusIDE.DoDropFiles(Sender,FileNames);

View File

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

View File

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

View File

@ -1505,7 +1505,6 @@ end;
procedure TPackageEditorForm.FormDropFiles(Sender: TObject;
const FileNames: array of String);
var
i: Integer;
Files: TStringList;
begin
{$IFDEF VerbosePkgEditDrag}
@ -1514,13 +1513,13 @@ begin
if length(FileNames)=0 then exit;
//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;
Files:=TStringList.Create;
try
for i:=0 to high(Filenames) do
Files.Add(FileNames[i]);
Files.AddStrings(FileNames);
AddUserFiles(Files);
finally
Files.Free;