branch: master commit e070f4c4d24e21b3c80d4f9cef73a7d4d4eade4e Author: Oleh Krehel <ohwoeo...@gmail.com> Commit: Oleh Krehel <ohwoeo...@gmail.com>
ivy.el (ivy-add-face-text-property): New defun * ivy.el (ivy--format-minibuffer-line): Use `ivy-add-face-text-property'. --- ivy.el | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/ivy.el b/ivy.el index c70fa65..2e9b586 100644 --- a/ivy.el +++ b/ivy.el @@ -2071,6 +2071,13 @@ SEPARATOR is used to join the candidates." ivy-minibuffer-match-face-4) "List of `ivy' faces for minibuffer group matches.") +(defun ivy-add-face-text-property (start end face str) + (if (fboundp 'add-face-text-property) + (add-face-text-property + start end face nil str) + (font-lock-append-text-property + start end 'face face str))) + (defun ivy--format-minibuffer-line (str) (let ((start 0) (str (copy-sequence str))) @@ -2090,19 +2097,9 @@ SEPARATOR is used to join the candidates." (t (nth (1+ (mod (+ i 2) (1- (length ivy-minibuffer-faces)))) ivy-minibuffer-faces))))) - (if (fboundp 'add-face-text-property) - (add-face-text-property - (match-beginning i) - (match-end i) - face - nil - str) - (font-lock-append-text-property - (match-beginning i) - (match-end i) - 'face - face - str))) + (ivy-add-face-text-property + (match-beginning i) (match-end i) + face str)) (cl-incf i))))) str))