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

company-box--height doesn't take default line-spacing into account and clips lines #180

Open
DivineDominion opened this issue Oct 12, 2021 · 0 comments · May be fixed by #181
Open

company-box--height doesn't take default line-spacing into account and clips lines #180

DivineDominion opened this issue Oct 12, 2021 · 0 comments · May be fixed by #181

Comments

@DivineDominion
Copy link

When displaying the overlay box, the char-height is used to compute the total height of the box:

(-let* (...
        (char-height (frame-char-height frame)) 
        ...))

Thing is: char-height isn't aware of additional line-spacing.

Example

Given this document:

Boooaaaaa
Boooiiiii
Boooooooo

And given (setq-default line-spacing 0) (default),

and company-mode with the capf and dabbrev backend enabled, this is the completion I get when I type another line with "Boo":

Screen Shot 2021-10-12 at 12 52 17
(The box fits all lines exactly)

(dabbrev probably picks up "boolean" from somewhere)

Now set (setq-default line-spacing 0.2), see that the document and the box respect this setting; but the box doesn't take it into account when computing the total height of the box.

Screen Shot 2021-10-12 at 12 52 40
(The box cuts off the last line)

That in turn clips the result list. The total box's height is computed without the extra spacing in mind.

Suggestions

I believe that (line-pixel-height) would be a better fit to calculate the actual line height instead of the character height of the frame.

Example values:

  1. line-spacing is 0.0
    • (frame-char-height): 24
    • (line-pixel-height): 24
  2. line-spacing is 0.2
    • (frame-char-height): 24
    • (line-pixel-height): 28

I'm not sure if (line-pixel-height), which operates on the current window, is as good as a per-frame char-height, or if this has unintended side-effect. It works in my experiments. But the notion of the "current window" could be lots of different things, so I'm not certain if this is truly the best way.

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

Successfully merging a pull request may close this issue.

1 participant