How to tweak posframe layout to accommodate vertico with marginalia?
DivineDominion opened this issue · 7 comments
I really like posframes, and I missed a proper posframe implementation ever since I switched from ivy to selectrum to, eventually, vertico.
One thing that puzzles me is how the combo of vertico with marginalia (and consult) produces the layout differently when using a posframe.
See this screenshot on an ultrawide monitor at 80% of the full screen width:
The columns don't align at all. They do if I don't use a posframe.
So I guess that the spacing is computed before the posframe is being used, i.e. the missing 20% are the problem.
I'm no elisp wiz, so I have had no luck with the available hooks and size customizations thus far to even figure out if I can affect the timing here. Like, can I make the results window recalculate offsets after the posframe has shown?
Increasing marginalia-margin-threshold
fixed the issue for me.
@andresilva I tried 10, 100, 1000 -- all look the same on my device. To replicate the results and not just show recent functions, I filtered for functions with the name hl-
.
Note: M-x
looks fine. It's multi-column layouts like variable and function lists that get confused.
@DivineDominion Can you try the newest Marginalia version if this helps? See minad/marginalia@acbaad4.
@minad Just tried the current HEAD. Behavior is the same, as far as I can tell.
But I realized my fault in describing the problem-- the screenshot shows how I filter for hl-
. That pulls together lines out of their neighboring order. Each line is well-formatted, but together they produces the "jagged" columns.
Each line fits the variable name's length. But it looks broken when the results are assembled:
It looks perfectly fine when you scroll down, because the columns move to the right to make room for the name.
It just looks weird when e.g. search results are assembled or recent results are prepended:
That's still no problem when I disable vertico-posframe-mode
:
@DivineDominion By any chance you have set marginalia-align to right?
I have similar issue as well (because spacemacs layers set it to right), I find the issue goes when I change back to left.
@fuyu0425 It's set to left
but I've ditched most of my posframes because using them increased the likelihood of Emacs hanging, for some reason.