Allow completion frontends to fontify candidates just-in-time
bug#48841, bug#47711
The variable may be bound by the frontend to a non-nil around
completion-producing calls like completion-all-completions. See
completion-lazy-hilit docstring for more info.
* lisp/minibuffer.el (completion-lazy-hilit): New variable.
(completion-lazy-hilit): New function.
(completion-lazy-hilit-fn): New variable.
(completion-pcm--regexp)
(completion--flex-score-last-md): New helper variables.
(completion--flex-score-1): New helper.
(completion-pcm--hilit-commonality): Use completion-lazy-hilit.
(completion--flex-adjust-metadata): Rework sorting code.