Git Product home page Git Product logo

Comments (25)

manuel-uberti avatar manuel-uberti commented on July 17, 2024

I am not seeing this behaviour:

Screenshot from 2021-04-07 08-34-41

Although this is from my configuration, not with emacs -Q.

EDIT: scratch that, I am seeing it too with more than two buffers open.

from vertico.

minad avatar minad commented on July 17, 2024

Yes, I am overwriting the variable (setq-local resize-mini-windows 'grow-only), since it must not be nil in order for the display to work. What I could do is to overwrite it only when it is nil and keep it otherwise. If you set the variable to t in your config, it should then grow and shrink as you expect. Does that sound like a good solution?

from vertico.

protesilaos avatar protesilaos commented on July 17, 2024

If you set the variable to t in your config, it should then grow and shrink as you expect. Does that sound like a good solution?

Yes, that sounds good, though it did not work in my case. The screenshot I shared originally had it to t. Same here:

Screenshot from 2021-04-07 09-51-02

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

Same for me here with (setq-default resize-mini-windows t).

from vertico.

minad avatar minad commented on July 17, 2024

Yes, that sounds good, though it did not work in my case. The screenshot I shared originally had it to t. Same here:

This sounds like an Emacs 28 bug then, you are both using Emacs 28, right? There have been some recent changes in Emacs 28 on how it resizes the minibuffer and Selectrum has also been affected by that.

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

Yes, I am on Emacs 28, and I did chat with @clemera about this problem on Selectrum here.

from vertico.

minad avatar minad commented on July 17, 2024

@manuel-uberti Yes, I've seen that discussion but didn't fully read it. Note that Vertico does not perform its own resizing, it simply relies on Emacs doing the right thing. For this reason I am also not setting truncate-lines to t since this would break the resizing on Emacs 27.

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

FTR, even with truncate-lines set to t (and resize-mini-windows set to t at the same time) the problem remains. I guess something is changed on Emacs master then.

from vertico.

minad avatar minad commented on July 17, 2024

If you have time I would appreciate if you report a bug or take a look if such a bug already exists. So to be precise, the minibuffer is grown correctly if you set 'grow-only? And if you set the variable to t it also grows but does not shrink as it should? If you set it to nil, the variable is still overwritten locally by Vertico with 'grow-only.

from vertico.

minad avatar minad commented on July 17, 2024

Maybe we can create a minimal reproducible example. This works for me on 27.1.

(defvar-local test-resize-ov nil)

(defun test-resize ()
  (if (overlay-get test-resize-ov 'after-string)
      (overlay-put test-resize-ov 'after-string nil)
    (overlay-put test-resize-ov 'after-string "Multiple Lines 1\nMultiple Lines 2\nMultiple Lines 3")))

(minibuffer-with-setup-hook
    (lambda ()
      (setq-local resize-mini-windows t)
      (setq test-resize-ov (make-overlay (point-max) (point-max) nil t t))
      (add-hook #'post-command-hook #'test-resize nil t))
  (read-from-minibuffer "Test: "))

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

These are the results with different values for resize-mini-windows:

  • 'grow-only: the minibuffer is grown as expected but doesn't shrink as it should
  • t: the minibuffer is grown as expected but doesn't shrink as it should
  • nil: the value for resize-mini-windows is locally set by vertico (i.e., Local in buffer *Minibuf-1*; global value is nil), but the behavior is as reported for 'grow-only and t

Let me try with your example.

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

With your code in emacs -Q, I get this.

Screenshot from 2021-04-07 14-25-16

How can I test the shrinking, though?

from vertico.

minad avatar minad commented on July 17, 2024

It is a toggler, just press a few keys "xxxxx"

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

Right, here we go:

Screenshot from 2021-04-07 14-29-29

from vertico.

minad avatar minad commented on July 17, 2024

Hmm :( So now we have to expand the minimal example...

from vertico.

minad avatar minad commented on July 17, 2024

Variant 1:

(defvar-local test-resize-ov nil)

(defun test-resize ()
  (if (or (not (overlay-get test-resize-ov 'after-string)) (string-match-p "Three" (overlay-get test-resize-ov 'after-string)))
      (overlay-put test-resize-ov 'after-string "Two Lines 1\nTwo Lines 2")
    (overlay-put test-resize-ov 'after-string "Three Lines 1\nThree Lines 2\nThree Lines 3")))

(minibuffer-with-setup-hook
    (lambda ()
      (setq-local resize-mini-windows t)
      (setq test-resize-ov (make-overlay (point-max) (point-max) nil t t))
      (add-hook #'post-command-hook #'test-resize nil t))
  (read-from-minibuffer "Test: "))

Variant 2:

(defvar-local test-resize-ov nil)

(defun test-resize ()
  (if (or (not (overlay-get test-resize-ov 'after-string)) (string-match-p "Three" (overlay-get test-resize-ov 'after-string)))
      (overlay-put test-resize-ov 'after-string "Two Lines 1\nTwo Lines 2")
    (overlay-put test-resize-ov 'after-string "Three Lines 1\nThree Lines 2\nThree Lines 3")))

(minibuffer-with-setup-hook
    (lambda ()
      (setq-local resize-mini-windows t)
      (setq-local truncate-lines nil) ;; ADDED
      (setq test-resize-ov (make-overlay (point-max) (point-max) nil t t))
      (add-hook #'post-command-hook #'test-resize nil t))
  (read-from-minibuffer "Test: "))

Variant 3:

(defvar-local test-resize-ov nil)

(defun test-resize ()
  (if (or (not (overlay-get test-resize-ov 'after-string)) (string-match-p "Three" (overlay-get test-resize-ov 'after-string)))
      (overlay-put test-resize-ov 'after-string "Two Lines 1\nTwo Lines 2")
    (overlay-put test-resize-ov 'after-string "Three Lines 1\nThree Lines 2\nThree Lines 3")))

(minibuffer-with-setup-hook
    (lambda ()
      (setq-local resize-mini-windows t)
      (setq-local truncate-lines nil) ;; ADDED
      (setq-local max-mini-window-height 1.0) ;; ADDED
      (setq test-resize-ov (make-overlay (point-max) (point-max) nil t t))
      (add-hook #'post-command-hook #'test-resize nil t))
  (read-from-minibuffer "Test: "))

Can you play a bit around with the various settings of vertico--setup if it is possible to figure out which setting causes the issue?

from vertico.

minad avatar minad commented on July 17, 2024

Another thing to try:

(add-hook #'post-command-hook #'test-resize -99 t) ;; Note the priority!

And yet another thing, you could insert this before the overlay-put.

(move-overlay test-resize-ov (point-max) (point-max))

I am fishing in the dark here - no idea which setting causes this...

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

Some results from emacs -Q:

Variant 1
1

2

3

Variant 2
4

5

6

Variant 3
Without posting other screenshots, same as above.

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

Also, with my init.el loaded and with these enabled:

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Auto-Image-File Column-Number Cursor-Intangible Delete-Selection Electric-Indent
Envrc-Global File-Name-Shadow Git-Identity-Magit Global-Company Global-Diff-Hl
Global-Eldoc Global-Font-Lock Global-So-Long Line-Number Menu-Bar
Minibuffer-Depth-Indicate Minibuffer-Electric-Default Mouse-Wheel Recentf
Save-Place Savehist Shell-Dirtrack Show-Paren Smartparens Smartparens-Global
Tool-Bar Transient-Mark Vertico Window-Divider Winner

I get the same behavior as in emacs -Q. My only customization for vertico is (setq vertico-count-format nil).

from vertico.

minad avatar minad commented on July 17, 2024

Okay, so we don't get a minimal example like this. You may want to try to stab randomly at vertico--exhibit and vertico--setup to see what causes this. I am pretty certain that this is a regression introduced in Emacs 28 since on 27 everything works as expected and I am not doing anything very unreasonable. Note that we used read-from-minibuffer in the above examples, you may want to replace that with completing-read instead and vertico-mode disabled in order to see if that changes anything.

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

Perhaps asking for help on emacs-devel might be the quicker route? I tried playing with the functions you mentioned, but beside what you already offered above in terms of setting I wasn't able to nail down the problem. I am fairly sure on emacs-devel who changed this behavior in Emacs 28 can give you some ideas.

from vertico.

minad avatar minad commented on July 17, 2024

Yes, sure. I should also install Emacs 28 at some point. Then I can produce a minimal reproducible example. However this is low priority for me right now. Since minibuffer growing works on 28 which is more important and on my 27.1 setup everything works as is.

from vertico.

minad avatar minad commented on July 17, 2024

I changed my mind and implemented this differently now. I truncate lines since this generally gives a better UI experience. And then I manually resize to the desired numbers of lines, which also gives a less bumpy experience in some cases. For example I use a resized face for the consult-buffer group titles. Please give it a try.

from vertico.

manuel-uberti avatar manuel-uberti commented on July 17, 2024

Just tried with resize-mini-windows set to t and it works as expected! Thank you for this.

from vertico.

minad avatar minad commented on July 17, 2024

Thank you for checking!

from vertico.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.