branch: master commit bd5e45333f6c324b459add66a7dd04d20a0c4d9b Author: Dmitry Gutov <dgu...@yandex.ru> Commit: Dmitry Gutov <dgu...@yandex.ru>
#267 follow-up fixes --- company-tests.el | 2 +- company.el | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/company-tests.el b/company-tests.el index 08b8463..31a7972 100644 --- a/company-tests.el +++ b/company-tests.el @@ -465,7 +465,7 @@ (let* ((ov company-preview-overlay) (str (overlay-get ov 'after-string))) (should (string= str "123")) - (should (eq (get-text-property 0 'cursor str) t))))))) + (should (eq (get-text-property 0 'cursor str) 1))))))) (ert-deftest company-pseudo-tooltip-show-with-annotations () :tags '(interactive) diff --git a/company.el b/company.el index e8ce966..e2ba78d 100644 --- a/company.el +++ b/company.el @@ -2423,7 +2423,7 @@ Returns a negative number if the tooltip should be displayed above point." (end (save-excursion (move-to-window-line (+ row (abs height))) (point))) - (ov (make-overlay (if nl beg (1- beg)) end nil t t)) + (ov (make-overlay (if nl beg (1- beg)) end nil t)) (args (list (mapcar 'company-plainify (company-buffer-lines beg end)) column nl above))) @@ -2547,11 +2547,12 @@ Returns a negative number if the tooltip should be displayed above point." (not (equal completion "")) (add-text-properties 0 1 '(cursor 1) completion)) - (let ((beg pos) - (ptf-workaround (and - company-pseudo-tooltip-overlay - (char-before pos) - (eq ?\n (char-after pos))))) + (let* ((beg pos) + (pto company-pseudo-tooltip-overlay) + (ptf-workaround (and + pto + (char-before pos) + (eq pos (overlay-start pto))))) ;; Try to accomodate for the pseudo-tooltip overlay, ;; which may start at the same position if it's at eol. (when ptf-workaround