summaryrefslogtreecommitdiff
path: root/lisp/minibuffer.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2020-02-12 21:39:44 +0200
committerEli Zaretskii <eliz@gnu.org>2020-02-12 21:39:44 +0200
commit027da652a4fc643a086a880aec30618b2bccb487 (patch)
treee4c94bb3ad04b794e1873e16b8f357de3ee4a77f /lisp/minibuffer.el
parent5a21aaff468ec3f0337117707cda4254cbef8de7 (diff)
downloademacs-027da652a4fc643a086a880aec30618b2bccb487.tar.gz
Fix display of minibuffer prompt in ido.el
* lisp/minibuffer.el (minibuffer--message-overlay-pos): New function. (set-minibuffer-message): Use it to determine where to show the overlay with the temporary message. * lisp/ido.el (ido-exhibit): Revert "Render Ido suggestions using an overlay"; this restores the original code which inserted the match-status information into the minibuffer, instead of displaying it in an overlay with an after-string. Put the special 'minibuffer-message' text property at the beginning of the inserted text. (Bug#39379) * etc/NEWS: * doc/lispref/display.texi (Displaying Messages): * doc/lispref/text.texi (Special Properties): Document the 'minibuffer-message' text property and its effect.
Diffstat (limited to 'lisp/minibuffer.el')
-rw-r--r--lisp/minibuffer.el18
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 0589211877a..49daabc44e3 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -763,8 +763,21 @@ and `clear-minibuffer-message' called automatically via
(defvar minibuffer-message-timer nil)
(defvar minibuffer-message-overlay nil)
+(defun minibuffer--message-overlay-pos ()
+ "Return position where `set-minibuffer-message' shall put message overlay."
+ ;; Starting from point, look for non-nil 'minibuffer-message'
+ ;; property, and return its position. If none found, return the EOB
+ ;; position.
+ (let* ((pt (point))
+ (propval (get-text-property pt 'minibuffer-message)))
+ (if propval pt
+ (next-single-property-change pt 'minibuffer-message nil (point-max)))))
+
(defun set-minibuffer-message (message)
"Temporarily display MESSAGE at the end of the minibuffer.
+If some part of the minibuffer text has the `minibuffer-message' property,
+the message will be displayed before the first such character, instead of
+at the end of the minibuffer.
The text is displayed for `minibuffer-message-clear-timeout' seconds
\(if the value is a number), or until the next input event arrives,
whichever comes first.
@@ -784,8 +797,9 @@ via `set-message-function'."
(clear-minibuffer-message)
- (setq minibuffer-message-overlay
- (make-overlay (point-max) (point-max) nil t t))
+ (let ((ovpos (minibuffer--message-overlay-pos)))
+ (setq minibuffer-message-overlay
+ (make-overlay ovpos ovpos nil t t)))
(unless (zerop (length message))
;; The current C cursor code doesn't know to use the overlay's
;; marker's stickiness to figure out whether to place the cursor