* lisp/minibuffer.el (completion-pcm--optimize-pattern): New function

This fixes bug#38458 where a final `point` in the pattern prevented
the expected normal behavior of point moving after the completion
of the final implicit `any`.

(completion-pcm--find-all-completions)
(completion-substring--all-completions): Use it.
(completion-basic--pattern): Don't both removing "" any more.
(completion-basic-try-completion): Use it as well as
`completion-basic--pattern`.
1 job for master in 64 minutes and 42 seconds (queued for 6 seconds)
Status Job ID Name Coverage
  Test
failed #4414
test-all

01:04:42

 
Name Stage Failure
failed
test-all Test
Makefile:319: recipe for target 'check-doit' failed
make[2]: Leaving directory '/builds/emacs/emacs/test'
make[2]: *** [check-doit] Error 1
make[1]: *** [check-expensive] Error 2
Makefile:294: recipe for target 'check-expensive' failed
make[1]: Leaving directory '/builds/emacs/emacs/test'
Makefile:959: recipe for target 'check-expensive' failed
make: *** [check-expensive] Error 2
ERROR: Job failed: exit code 1