Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ivy.el
Original file line number Diff line number Diff line change
Expand Up @@ -3263,9 +3263,14 @@ parts beyond their respective faces `ivy-confirm-face' and
(when ivy-add-newline-after-prompt
(setq n-str (concat n-str "\n")))
(setq n-str (ivy--break-lines n-str (window-width)))
(set-text-properties 0 (length n-str)
`(face minibuffer-prompt ,@std-props)
n-str)
(let ((old-props (when (fboundp 'object-intervals)
(object-intervals n-str))))
(set-text-properties 0 (length n-str)
`(face minibuffer-prompt ,@std-props)
n-str)
(dolist (propdata old-props)
(cl-destructuring-bind (beg end props) propdata
(add-text-properties beg end props n-str))))
(setq n-str (funcall ivy-set-prompt-text-properties-function
n-str std-props))
Comment on lines -3266 to 3275
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right after the set-text-properties call, there is a call to the variable ivy-set-prompt-text-properties-function, which is allowed to modify the prompt in-place.

Can you please describe in more detail what use-case you are considering, that can't already be addressed via ivy-set-prompt-text-properties-function?

In general, I would prefer to avoid relying on object-intervals, or needing to copy each interval over manually. At least, not by default, and not if we can think of another solution.

For example, set-text-properties could be replaced with add-text-properties. Or, std-props could be turned into a variable that can be bound around relevant calls to Ivy. But I would like to better understand the motivation before making such changes.

(insert n-str))
Expand Down