Skip to content

Commit

Permalink
Pass pos-tip a POS outside of the overlay
Browse files Browse the repository at this point in the history
Because posn-at-point returns wrong coordinates in that case.

Fixes #72
  • Loading branch information
dgutov committed Jun 24, 2020
1 parent 65d6df6 commit 9a0d860
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions company-quickhelp.el
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,13 @@ currently active `company' completion candidate."
(+ (line-number-display-width) 2) 0))))
(x-gtk-use-system-tooltips nil)
(fg-bg `(,company-quickhelp-color-foreground
. ,company-quickhelp-color-background)))
. ,company-quickhelp-color-background))
(pos (save-excursion
(goto-char (overlay-start ovl))
(line-beginning-position)))
(dy (if (and ovl (< (overlay-get ovl 'company-height) 0))
0
nil)))
(when (and ovl doc)
(with-no-warnings
(if company-quickhelp-use-propertized-text
Expand All @@ -208,12 +214,12 @@ currently active `company' completion candidate."
(> (cdr w-h) max-height))
(setq doc (pos-tip-truncate-string doc max-width max-height)
w-h (pos-tip-string-width-height doc))))
(pos-tip-show-no-propertize doc fg-bg (overlay-start ovl) nil timeout
(pos-tip-show-no-propertize doc fg-bg pos nil timeout
(pos-tip-tooltip-width (car w-h) (frame-char-width frame))
(pos-tip-tooltip-height (cdr w-h) (frame-char-height frame) frame)
nil (+ overlay-width overlay-position) 1))
(pos-tip-show doc fg-bg (overlay-start ovl) nil timeout width nil
(+ overlay-width overlay-position) 1))))))))
nil (+ overlay-width overlay-position) dy))
(pos-tip-show doc fg-bg pos nil timeout width nil
(+ overlay-width overlay-position) dy))))))))

(defun company-quickhelp--set-timer ()
(when (or (null company-quickhelp--timer)
Expand Down

0 comments on commit 9a0d860

Please sign in to comment.