Comments (25)
I am not seeing this behaviour:
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.
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.
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:
from vertico.
Same for me here with (setq-default resize-mini-windows t)
.
from vertico.
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.
Yes, I am on Emacs 28, and I did chat with @clemera about this problem on Selectrum here.
from vertico.
@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.
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.
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.
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.
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 shouldt
: the minibuffer is grown as expected but doesn't shrink as it shouldnil
: the value forresize-mini-windows
is locally set byvertico
(i.e.,Local in buffer *Minibuf-1*; global value is nil
), but the behavior is as reported for'grow-only
andt
Let me try with your example.
from vertico.
With your code in emacs -Q
, I get this.
How can I test the shrinking, though?
from vertico.
It is a toggler, just press a few keys "xxxxx"
from vertico.
Right, here we go:
from vertico.
Hmm :( So now we have to expand the minimal example...
from vertico.
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.
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.
Some results from emacs -Q
:
Variant 3
Without posting other screenshots, same as above.
from vertico.
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.
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.
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.
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.
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.
Just tried with resize-mini-windows
set to t
and it works as expected! Thank you for this.
from vertico.
Thank you for checking!
from vertico.
Related Issues (20)
- Error in post-command-hook (vertico--exhibit): (void-function compat--string-width) HOT 1
- File name column takes to much space (even truncated with custom code).)
- Error in `execute extended command` minibuffer
- Refresh on `backward-kill-word`
- The alternative to M-RET doesn't work or is poorly described
- Emacs 30 freezes if there isn't enough room due to window-size-fixed HOT 1
- Lagging cursor movement in Wayland
- Vertico distorts email attachments
- reject completions?
- Problematic completion Org mode commands
- Performance issues
- Pull request: don't delete right side of minibuffer after TAB HOT 1
- vertico-flat-mode with vertico-flat-max-lines > 1 does not respect (setq vertico-resize 'grow-only) HOT 5
- Query Regarding Functionality Similar to ivy-restrict-to-matches
- How to achieve fuzzy completion HOT 1
- Use a different sort strategy per command
- Error in post-command-hook (vertico--exhibit): (cyclic-function-indirection ConTeXt-mode)
- Keyboard macro and default M-x command selection
- Blank line among function completions with llama installed
- Odd issue with read-file-name and vertico
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vertico.