Hi Dario,
Sorry for the delay in handling this.
I haven't had time to look into it in detail, which I must do since
it is reasonably complex. However it looks good on the surface
and from what I remember your original bug report holds water.
I have two questions and a nitpick:
1. Question: if I compile and/or evaluate the changes to the
test/lisp/minibuffer-tests.el file but _don't_ compile the changes
to the lisp/minibuffer.el file, will they expose this bug and this
bug only? In other words, will I get exactly the same failures
that you describe originally in this issue and will that fact be
apparent in the failure message(s)?
2. Question: are the changes to completion-pcm--optimize-pattern
an optimization or does the fix above depend on them? If the
former, could you make it a separate commit?
3. Nitpick: the commit message is broadly according to the
format, but I find it hard to parse its intentions. Though
conventions vary, I usually like to format the commit message
like in this example which separates the what, the why and
the how.
"Fix the thing imperatively because racecar (bug#12345)
Before, when the user did foo the system stupidly behaved
bar. Now it's much better, it does baz.
I fixed this by doing quux and quzz
* file (function): use more intense quuxing."
João