all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: dgutov@yandex.ru
Cc: 39379@debbugs.gnu.org, wyuenho@gmail.com
Subject: bug#39379: 27.0.60; Fix for #38457 broke ido-vertical-mode
Date: Mon, 10 Feb 2020 17:44:08 +0200	[thread overview]
Message-ID: <83zhdqbg6v.fsf@gnu.org> (raw)
In-Reply-To: <83a760j23r.fsf@gnu.org> (message from Eli Zaretskii on Sun, 02 Feb 2020 20:06:16 +0200)

> Date: Sun, 02 Feb 2020 20:06:16 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 39379@debbugs.gnu.org, dgutov@yandex.ru
> 
> > Date: Sun, 02 Feb 2020 19:23:46 +0200
> > From: Eli Zaretskii <eliz@gnu.org>
> > Cc: 39379@debbugs.gnu.org, dgutov@yandex.ru
> > 
> > I think this could be a bug in the display engine, related to resizing
> > the mini-window when an after-string that includes many newlines is
> > put at EOB.  Let me look into it.
> 
> Looks like my guess was correct.  I'll try to devise a solution.

Sorry for a relatively long delay.  In my defense, I first tried a
couple of easy solutions, but they didn't work.  And that got me
thinking, since my experience with solving issues like this due to
overlay strings is that the solutions tend to be less than elegant,
and take several attempts to get them right.

So now, after thinking about this for some time, I think I want to
change my mind and ask why do we need to use an overlay with
after-string in ido.el?  Re-reading related discussions, it seems the
answer is "so that the temporary display of messages is not at the end
of the minibuffer, where it could be invisible due to
resize-mini-windows being nil or restrictions imposed by ido.el via
ido-max-window-height".  Is that the correct conclusion?  If so, then
I think we can solve that problem without overlays.  See the proposed
patch below, which basically reverts ido.el to its previous shape, and
uses a special text property to instruct set-minibuffer-message where
to put the overlay (defaulting to EOB).

WDYT?

diff --git a/lisp/ido.el b/lisp/ido.el
index 6707d81407..edc848f52f 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -4728,16 +4728,10 @@ ido-exhibit
 	(let ((inf (ido-completions contents)))
 	  (setq ido-show-confirm-message nil)
 	  (ido-trace "inf" inf)
-          (when ido--overlay
-            (delete-overlay ido--overlay))
-          (let ((o (make-overlay (point-max) (point-max) nil t t)))
-            (when (> (length inf) 0)
-              ;; For hacks that redefine ido-completions function (bug#39379)
-              (when (eq (aref inf 0) ?\n)
-                (setq inf (concat " " inf)))
-              (put-text-property 0 1 'cursor t inf))
-            (overlay-put o 'after-string inf)
-            (setq ido--overlay o)))
+          (let ((pos (point)))
+            (insert inf)
+            (put-text-property pos (1+ pos) 'minibuffer-message t))
+          )
 	))))
 
 (defun ido-completions (name)
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 0589211877..767fc8dff8 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -763,6 +763,16 @@ minibuffer-message-clear-timeout
 (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.
 The text is displayed for `minibuffer-message-clear-timeout' seconds
@@ -784,8 +794,9 @@ set-minibuffer-message
 
       (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





  parent reply	other threads:[~2020-02-10 15:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 23:53 bug#39379: 27.0.60; Fix for #38457 broke ido-vertical-mode Jimmy Yuen Ho Wong
2020-02-01  8:12 ` Eli Zaretskii
2020-02-02 13:58   ` Jimmy Yuen Ho Wong
2020-02-02 16:13     ` Eli Zaretskii
2020-02-02 17:23       ` Eli Zaretskii
2020-02-02 18:06         ` Eli Zaretskii
2020-02-02 18:38           ` Eli Zaretskii
2020-02-02 21:33             ` Jimmy Yuen Ho Wong
2020-02-03  3:21               ` Eli Zaretskii
2020-02-03 13:19               ` Dmitry Gutov
2020-02-03 15:40                 ` Eli Zaretskii
2020-02-03 21:51                   ` Dmitry Gutov
2020-02-04  3:27                     ` Eli Zaretskii
2020-02-04 13:19                       ` Dmitry Gutov
2020-02-04 15:40                         ` Eli Zaretskii
2020-02-04 23:55                           ` Dmitry Gutov
2020-02-05  3:36                             ` Eli Zaretskii
2020-02-10 15:44           ` Eli Zaretskii [this message]
2020-02-11 23:42             ` Dmitry Gutov
2020-02-12 18:18               ` Eli Zaretskii
2020-02-12 18:24                 ` Dmitry Gutov
2020-02-12 19:42                   ` Eli Zaretskii
2020-03-03 14:02                   ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83zhdqbg6v.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=39379@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    --cc=wyuenho@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.