fix #412 - todo list empty when opening a file owned by the project for the first time

This commit is contained in:
Basile Burg 2019-01-20 13:18:34 +01:00
parent 842d5b7c3b
commit abe56ec68e
1 changed files with 14 additions and 6 deletions

View File

@ -329,7 +329,14 @@ end;
procedure TTodoListWidget.docFocused(document: TDexedMemo);
begin
if document = fDoc then
if fdoc.isNil then
exit;
// issue 412 :
// 1. the file name is in a first time "<new document>"
// 2. document assigned the fDoc var
// 3. once the filename loaded it exited on next focused
// because diff for filename was not tested.
if (document = fDoc) and (fDoc.fileName = document.fileName) then
exit;
fDoc := document;
if Visible and fAutoRefresh then
@ -425,16 +432,17 @@ var
str: string = '';
begin
clearTodoList;
if not exeInSysPath(ToolExeName) then
exit;
killToolProcess;
ctxt := getContext;
case ctxt of
tcNone: exit;
tcProject: if (fProj = nil) or (fProj.sourcesCount = 0) then exit;
tcFile: if fDoc = nil then exit;
end;
if not exeInSysPath(ToolExeName) then
exit;
//
killToolProcess;
fToolProc := TDexedProcess.Create(nil);
fToolProc.Executable := exeFullName(ToolExeName);
fToolProc.Options := [poUsePipes];
@ -459,7 +467,7 @@ begin
else str := fDoc.fileName;
fToolProc.Parameters.Add('-f' + str);
fToolProc.Parameters.Add('-t');
//
fToolProc.Execute;
fToolProc.CloseInput;
end;