[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Support "\n" in icomplete-separator
From: |
Gregory Heytings |
Subject: |
Re: [PATCH] Support "\n" in icomplete-separator |
Date: |
Tue, 10 Nov 2020 18:18:33 +0000 |
User-agent: |
Alpine 2.22 (NEB 394 2020-01-19) |
(defvar o (make-overlay 0 0 nil t t))
(minibuffer-with-setup-hook
(lambda ()
(set (make-local-variable 'face-remapping-alist)
'((default :height 1.3)))
(move-overlay o (point) (point) (current-buffer))
(let ((text (mapconcat
#'identity
'("Some" "text" "that" "will" "not" "fit"
"the" "minibuffer" "window")
"\n")))
(put-text-property 0 1 'cursor t text)
(overlay-put o 'after-string text)))
(read-string "Multiline\nprompt: "))
This is one of the cases where it does not work, indeed. Another one is
(again with emacs -Q):
(let (w bd)
(setq w 60)
(setq bd (concat (temporary-file-directory) (make-string w ?a) "/"))
(dolist (d '("a" "b" "c" "d" "e")) (make-directory (concat bd d) t))
(setq default-directory bd)
(set-frame-height nil 20)
(set-frame-width nil (+ (length bd) 10))
(icomplete-mode)
(setq icomplete-separator "\n")
(call-interactively 'insert-file))
Is it possible to make the prompt visible?
Yes it is. As I already told you, to make the prompt visible in all cases
(when it is not impossible to make it visible) it is necessary to ask
redisplay to start displaying at the beginning of the buffer. I provided
short and simple Lisp-only solution for this:
(defvar-local start-display-at-beginning-of-minibuffer nil)
(defun start-display-at-beginning-of-minibuffer (&rest args)
(when (and start-display-at-beginning-of-minibuffer (minibufferp))
(set-window-start-at-begin (point-min) (point))))
(defun set-window-start-at-begin (beg end)
(when (< (+ beg 2) end)
(set-window-start nil beg)
(unless (pos-visible-in-window-p end nil t)
(set-window-start-at-begin (+ beg (/ (- end beg) 2)) end))))
(add-hook 'window-scroll-functions #'start-display-at-beginning-of-minibuffer)
(add-hook 'post-command-hook #'start-display-at-beginning-of-minibuffer)
Just add (setq start-display-at-beginning-of-minibuffer t) in your
minibuffer-with-setup-hook lambda, and it will work as you expect it to
work.
As I said a few days ago in the "Feature branches review please" thread,
the problem of this solution is that Eli doesn't like it. He thinks
another solution, using a text property that would be put on the prompt,
should be implemented. Stefan thinks yet another solution, using the
buffer redisplay routines instead of using a specific redisplay code for
minibuffers, should be used.
Should I file bug report for this?
I think you should read the other relevant bug reports first (bug#24293,
bug#39379, bug#43519 and bug#43572). AFAIU the remaining 1% cases which
are demonstrated by the two above recipes are not considered important
enough to be classified as "bugs", so it is more a "feature request".
- Re: [PATCH] Support "\n" in icomplete-separator, (continued)
- Re: [PATCH] Support "\n" in icomplete-separator, Gregory Heytings, 2020/11/06
- Re: [PATCH] Support "\n" in icomplete-separator, Andrii Kolomoiets, 2020/11/06
- Re: [PATCH] Support "\n" in icomplete-separator, Eli Zaretskii, 2020/11/08
- Re: [PATCH] Support "\n" in icomplete-separator, Andrii Kolomoiets, 2020/11/09
- Re: [PATCH] Support "\n" in icomplete-separator, Eli Zaretskii, 2020/11/10
- Re: [PATCH] Support "\n" in icomplete-separator, Andrii Kolomoiets, 2020/11/10
- Re: [PATCH] Support "\n" in icomplete-separator,
Gregory Heytings <=
- Re: [PATCH] Support "\n" in icomplete-separator, Andrii Kolomoiets, 2020/11/11
- Re: [PATCH] Support "\n" in icomplete-separator, Eli Zaretskii, 2020/11/10
- Re: [PATCH] Support "\n" in icomplete-separator, Gregory Heytings, 2020/11/10
- Re: [PATCH] Support "\n" in icomplete-separator, Eli Zaretskii, 2020/11/10
- Re: [PATCH] Support "\n" in icomplete-separator, Gregory Heytings, 2020/11/10
- Re: [PATCH] Support "\n" in icomplete-separator, Andrii Kolomoiets, 2020/11/10
- Re: [PATCH] Support "\n" in icomplete-separator, martin rudalics, 2020/11/11
- Re: [PATCH] Support "\n" in icomplete-separator, Gregory Heytings, 2020/11/11
- Re: [PATCH] Support "\n" in icomplete-separator, Jean Louis, 2020/11/11
- Re: [PATCH] Support "\n" in icomplete-separator, Andrii Kolomoiets, 2020/11/11