View Issue Details

IDProjectCategoryView StatusLast Update
0036721LazarusPackagespublic2020-04-14 13:40
ReporterKevin Jesshope Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
PlatformLazarus IDE v2.1.0OSWin64 
Product Version2.0.7 (SVN) 
Summary0036721: ToDoList.pas comments and code inconsistencies
Descriptionin Components/todolist/ToDoList.pas

The main comments at the top of the unit:
1 - do not reference the Priority option
2 - refer to a semicolon when it is actually a colon in the code.
3 - indicate that the {TODO Text WIthout Colon} is valid - it is not (see comment at line ToDoList.pas:569 // Alternative keyword requires a semicolon to prevent false positives.)
4 - indicate that the {Done Text WIthout Colon} is valid - it is not (see comment at line ToDoList.pas:569 // Alternative keyword requires a semicolon to prevent false positives.)

The code has a constant cSemicolon at line 487 when it is actually a colon in TIDETodoWindow.CreateToDoItem
It also has a boolean var HasSemiColon that should be HasColon
TagsNo tags attached.
Fixed in Revisionr62657
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

Kevin Jesshope

2020-02-21 14:59

reporter  

todolist.pas-comments_and_colon.patch (2,681 bytes)   
Index: todolist.pas
===================================================================
--- todolist.pas	(revision 62655)
+++ todolist.pas	(working copy)
@@ -34,17 +34,15 @@
   Abstract:
     List all to do comments of current project and the file
     projectname.todo.
-    {TODO -oOwnerName -cCategoryName: Todo_text}
-    {DONE -oOwnerName -cCategoryName: Todo_text}
-    {#todo -oOwnerName -cCategoryName: Todo_text}
-    {#done -oOwnerName -cCategoryName: Todo_text}
+    {TODO Priority -oOwnerName -cCategoryName: Todo_text}
+    {DONE Priority -oOwnerName -cCategoryName: Todo_text}
+    {#todo Priority -oOwnerName -cCategoryName: Todo_text}
+    {#done Priority -oOwnerName -cCategoryName: Todo_text}
 
-    the -o and -c tags are optional.
+    the Priority, -o and -c tags are optional.
 
-    If the -o and -c tags are not used, then the variant without semicolon is
-    allowed too:
-    {TODO Todo_text}
-    {DONE Todo_text}
+    If the -o and -c tags are not used, then the variant without colon is
+    allowed too for the #todo and #done forms only:
     {#todo Todo_text}
     {#done Todo_text}
 
@@ -474,12 +472,12 @@
 var
   N, Strlen: Integer;
   TempStr, ParsingString, LowerString : string;
-  IsAltNotation, IsDone, HasSemiColon: boolean;
+  IsAltNotation, IsDone, HasColon: boolean;
   aChar: char;
   TodoItem: TTodoItem;
 
 const
-  cSemiColon  = ':';
+  cColon  = ':';
   cWhiteSpace = ' ';
   
   Procedure SetItemFields(aItem: TTodoItem; aStr: String);
@@ -560,9 +558,9 @@
   else
     Delete(ParsingString, 1, 5);
 
-  HasSemiColon := Pos(cSemiColon, ParsingString)>0;
-  // Alternative keyword requires a semicolon to prevent false positives.
-  if HasSemiColon or not IsAltNotation then
+  HasColon := Pos(cColon, ParsingString)>0;
+  // Alternative keyword requires a colon to prevent false positives.
+  if HasColon or not IsAltNotation then
   begin
     TodoItem := TTodoItem.Create(aTLFile);
     TodoItem.Done := IsDone;
@@ -572,7 +570,7 @@
     if aTLFile<>nil then
       aTLFile.Add(TodoItem);
 
-    if HasSemiColon then
+    if HasColon then
     begin
       // Parse priority, owner and category
       n := 1;
@@ -579,11 +577,11 @@
       TempStr := '';
       Strlen  := Length(ParsingString);
 
-      while (n <= StrLen) and (ParsingString[n]<>cSemiColon) do
+      while (n <= StrLen) and (ParsingString[n]<>cColon) do
       begin
         aChar := ParsingString[n];
         // Add char to temporary string
-        if (aChar<>cSemiColon) and (aChar<>cWhiteSpace) then
+        if (aChar<>cColon) and (aChar<>cWhiteSpace) then
           TempStr := TempStr + aChar
         // Process temporary string
         else

Juha Manninen

2020-02-21 20:28

developer   ~0121184

Applied, thanks.
I also added your name to the list of contributors.

Issue History

Date Modified Username Field Change
2020-02-21 14:59 Kevin Jesshope New Issue
2020-02-21 14:59 Kevin Jesshope File Added: todolist.pas-comments_and_colon.patch
2020-02-21 14:59 Kevin Jesshope Issue generated from: 0036717
2020-02-21 20:18 Juha Manninen Assigned To => Juha Manninen
2020-02-21 20:18 Juha Manninen Status new => assigned
2020-02-21 20:28 Juha Manninen Status assigned => resolved
2020-02-21 20:28 Juha Manninen Resolution open => fixed
2020-02-21 20:28 Juha Manninen Fixed in Revision => r62657
2020-02-21 20:28 Juha Manninen LazTarget => -
2020-02-21 20:28 Juha Manninen Widgetset Win32/Win64 => Win32/Win64
2020-02-21 20:28 Juha Manninen Note Added: 0121184
2020-04-14 13:40 Kevin Jesshope Issue cloned: 0036914