A simple modification should ensure this happens always (it seems to be a good solution). Any objections?
Since you're digging into that parsing code, here are some other wonky test cases you might be able to clear up.
This registers incorrectly as 2 entries:
char *x = "// TODO";
// TODO: Fix
This registers incorrectly as 0 entries:
char *x = "TODO";
// TODO: Fix
This registers incorrectly as 0 entries:
char *x = "NOTE";
// NOTE: Fix
Although, oddly, this correctly gives the one TODO entry.
char *x = "NOTE";
// TODO: Fix