From abe56ec68e765854d789c2f31bba7791ce8ed871 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 20 Jan 2019 13:18:34 +0100 Subject: [PATCH] fix #412 - todo list empty when opening a file owned by the project for the first time --- src/u_todolist.pas | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/u_todolist.pas b/src/u_todolist.pas index 6f73c0cc..3620d809 100644 --- a/src/u_todolist.pas +++ b/src/u_todolist.pas @@ -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 "" + // 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;