speed up label detection by pre-caching label colon candidate positions

Previously the algorithm had to repeatedly scan the same line with regex
each time a new word is found, leading to performance that gets
significantly worse with longer lines. By identifying candidates for label
colons for the whole line only once and caching them, the worsening can be
reduced substantially. No particular downside should occur for lines where
this check isn't run, because candidate identification is only run on a
line the first time the check is run.