tumashu / vertico-posframe

GNU General Public License v3.0
119 stars 16 forks source link

How to tweak posframe layout to accommodate vertico with marginalia? #4

Open DivineDominion opened 3 years ago

DivineDominion commented 3 years ago

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:

Screen Shot 2021-11-03 at 21 27 27

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?

andresilva commented 3 years ago

Increasing marginalia-margin-threshold fixed the issue for me.

DivineDominion commented 3 years ago

@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-.

Screen Shot 2021-11-16 at 19 35 44

Note: M-x looks fine. It's multi-column layouts like variable and function lists that get confused.

Screen Shot 2021-11-16 at 19 40 16

tumashu commented 2 years ago

I have try, seem to no problem: 图片

minad commented 2 years ago

@DivineDominion Can you try the newest Marginalia version if this helps? See https://github.com/minad/marginalia/commit/acbaad4bda9ee2166d55a2ef61521b97170202b3.

DivineDominion commented 2 years ago

@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:

Screen Shot 2021-12-27 at 11 48 15

It looks perfectly fine when you scroll down, because the columns move to the right to make room for the name.

Screen Shot 2021-12-27 at 11 48 34

It just looks weird when e.g. search results are assembled or recent results are prepended:

Screen Shot 2021-12-27 at 11 54 14

That's still no problem when I disable vertico-posframe-mode:

Screen Shot 2021-12-27 at 11 55 33

fuyu0425 commented 1 year ago

@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.

DivineDominion commented 1 year ago

@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.