company-mode / company-quickhelp

Documentation popup for Company
GNU General Public License v3.0
374 stars 33 forks source link

Fixed pos-tip position relative to line numbers #104

Closed Dr-Dd closed 4 years ago

Dr-Dd commented 4 years ago

Added offset determined by the presence (or absence) of line-numbers. The errand 2 is the number of columns that line numbers occupy including the current line-number width, as in █nnn█. The two ascii blocks are the two extra columns, for a total of 3+2=5 width.

This fixes #96

Dr-Dd commented 4 years ago

With line numbers disabled the function returns 0.

The function is only available from emacs 26 onward, since display-line-numbers-mode got introduced with the same release. I followed company--posn-col-row example as suggested to preserve backwards compat.

dgutov commented 4 years ago

Add

;; To avoid warnings in Emacs < 26.
(declare-function line-number-display-width "indent.c")

and we're good to go.

dgutov commented 4 years ago

Thanks!