Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How large is the minibuffer window by default? #27

Open
vherrmann opened this issue Mar 20, 2022 · 5 comments
Open

How large is the minibuffer window by default? #27

vherrmann opened this issue Mar 20, 2022 · 5 comments

Comments

@vherrmann
Copy link
Contributor

This is just a sort-of personal question (which could be relevant to others), so you can close this immediately in case you want to.

I have the following problem. I use vertico with doom emacs and all other consult commands I use take up ca. 1/3 of the screen:
screen_2022-03-20_12-00-46

To the contrary, consult-lsp-diagnostics can take up almost all of my screen:
screen_2022-03-20_11-58-12

So I wonder if you could help me limit this to 1/3 of the screen.

@vherrmann vherrmann changed the title How big is the minibuffer window per default? How large is the minibuffer window per default? Mar 20, 2022
@vherrmann vherrmann changed the title How large is the minibuffer window per default? How large is the minibuffer window by default? Mar 20, 2022
@gagbo
Copy link
Owner

gagbo commented Mar 20, 2022

Hello,

A wild guess about how minibuffer height is handled

It looks like the issue is that Emacs checks for the "max height" condition only after it already added the next candidate, like

Add candidate in the minibuffer
Check minibuffer height
If too big, stop
else continue

And since the diagnostics here are multiline and fully rendered, adding one diagnostic which is very high (because it's a multiline candidate) kind of breaks the height limit.

@minad do you know if/how consult and vertico tries to limit the minibuffer height ? I wonder if my assumption about the mechanics is correct or not.

A fix ?

This comes back to "How do we want to handle multiline candidates?". I know that minad preferred to heavily truncate the results if they are too long/multiline, in my most common cases (Clangd and Rust-analyzer diagnostics) it was mostly fine to have all the lines so I didn't bother truncating everything. Now that I see really big diagnostics coming, I think I'll have to truncate them.

The choice of truncation/not truncation is done in the transformer (I assume that you knew this, and it's kind of the reason for your PR), It used to replace newlines with spaces and then let Emacs deal with the awfully long lines. Then I changed it to only use the raw diagnostic thinking I would test this and see if it's good or not.

It seems that it's not good after all (I expect that the height control mechanism is not something I can easily fix), so I'll probably revert that commit soon-ish

@minad
Copy link

minad commented Mar 20, 2022

This is not Vertico. (EDIT: @vherrmann mentioned that he uses Vertico, but Vertico should wrap newlines in any case so something else is wrong here. As I understand, @gagbo, consult-lsp produces annotations with newlines. This is unsupported.)

@vherrmann
Copy link
Contributor Author

vherrmann commented Mar 20, 2022

It looks like the issue is that Emacs checks for the "max height" condition only after it already added the next candidate, like

@gagbo
This doesn't seem to be the case:
screen_2022-03-20_15-22-19

Maybe emacs computes how many lines the minibuffer should have and uses the same number of strings, which in this case are longer than just one line.

@vherrmann
Copy link
Contributor Author

vherrmann commented Mar 20, 2022

It seems that it's not good after all (I expect that the height control mechanism is not something I can easily fix), so I'll probably revert that commit soon-ish

Hmm, I actually kind of like it with multiple-lines, since its much harder to read the haskell diagnostics with them being truncated in one line.

EDIT: though I probably could use consult to get to a certain error and then show the specific error in a popup or sth.

@gagbo
Copy link
Owner

gagbo commented Mar 20, 2022

Vertico should wrap newlines in any case so something else is wrong here

I forgot about this part sorry, and it's not the first time you told me that :( I'll toy with the annotations then.

(FTR, indeed consult-lsp creates a raw multi-line annotation from the results)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants