Placeholder Bug

There seems to be a bug in Scrivener 3 on how many times you can use auto-numbering placeholders to cross-reference. It seems you can only reference twice before Scrivener treats the reference as plain text. Addition of more references results in a refusal to compile (the compiler seems to be stuck in a loop).

Here is the results using the example given in Scrivener.

Input
Figure <$n:figure>, Figure <$n:figure>, Please see figure <$n#figure>
Output
Figure 1, Figure 2, Please see figure 2

Input
Figure <$n:figure>, Figure <$n:figure>, Please see figure <$n#figure>, figure <$n#figure>, figure <$n#figure>
Output
Figure 1, Figure 2, Please see figure 2, figure 2, figure <$n#figure>

As can be seen, the compiled text has not replaced the third cross-reference placeholder, it seems to see it as plain text.

Input
Figure <$n:figure>, Figure <$n:figure>, Please see figure <$n#figure>, figure <$n#figure>, figure <$n#figure>, figure <$n#figure>
Output
Will not compile when trying to reference the figure four times.

Is this a bug or am I missing something?

This is indeed a bug. The code is using an accumulative length change in calculating what to search for next instead of the length change for the current loop, causing it to skip placeholders and throw an exception if it gets to a certain point. I’ve fixed this for 3.0.1 - thanks for reporting it.

All the best,
Keith

Thanks Keith. Sorry for my multiple posts. I posted it here first, then realised I should have put it in the Bug Hunt (so that is what I did). Then I realised you had a bug reporting system so I then used that. Sorry to have bombarded you with the same thing over and over.