Subject: Re: bug#46177: 27.1; Display problem with minibuffer overlay when using display property

From: Clemens <[email-masked]>
Date: Fri, 29 Jan 2021 21:26:26 +0100

> That's a feature: Emacs treats display strings and overlay strings
> differently for the purposes of face merging.

Okay, thanks. I have a problem with this when displaying completion 
candidates in the minibuffer. The candidates are displayed via 
`after-string` overlay. The candidates are provided by the caller and 
can contain the `display` property. Right now I "inline" any parts of 
the string that use `display` to avoid this:

(defun selectrum--display-string (str)
   "Return display string of STR."
   (let ((len (length str))
         (display "")
         (start 0)
         (end 0))
     (while (not (eq len end))
       (setq end (next-single-property-change start 'display str len))
       (let ((val  (get-text-property start 'display str)))
         (if (and val (stringp val))
             (setq display (concat display val))
           (setq display (concat display (substring str start end)))))
       (setq start end))
     display))

Is there a better way?