Subject: bug#27427: 26.0.50; Native line numbers lead to display error in company-mode popup

From: Eli Zaretskii <[email-masked]>
Date: Mon, 19 Jun 2017 20:08:47 +0300

> From: Alexander Miller <[email-masked]>
> Date: Mon, 19 Jun 2017 18:50:18 +0200
> 
> As requested by Eli on reddit, a proper bug report about the company issue:

Thanks.

> Using the new native line numbers in emacs -q
> alongside company mode results in line numbers not being rendered in
> lines where the company-mode popup is active. This is the same as in
> (n)linum-mode, however the company popup, except the first line, is also
> shifted to the left into the space line numbers used to occupy:
> http://imgur.com/xHf2mlp

Can you show a minimal recipe, assuming company-mode was already
loaded, to reproduce the issue?  Such a recipe will make the job of
looking into the issue much easier, TIA.

> It looks like there's a general issue of overlay using packages not
> expecting the space now being used by line numbers. For example the
> fill-column-indicator package draws its indicator too far to the left
> and swerves off with the comments at the top for some reason:
> http://imgur.com/WHcrhdC
> (Don't know why the company popup looks even worse here, that doesn't
> happen when I load my full config).

It looks like some packages need to revisit their calculations of
horizontal coordinates.  I'm guessing they convert column numbers into
pixels, which will err when line numbers are displayed.  They should
instead use posn-at-point and the likes.  Per Martin's analysis, the
same problems should happen when the buffer has line-prefix defined;
could you try that?