From c7b852f8d52b090c696311b2b577bb7442c26de4 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sun, 14 Sep 2014 02:39:06 +0400 Subject: [PATCH] company-pseudo-tooltip-guard: Handle wrapped lines --- company.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/company.el b/company.el index 39c120b2a..504fa0f49 100644 --- a/company.el +++ b/company.el @@ -2446,11 +2446,15 @@ Returns a negative number if the tooltip should be displayed above point." (overlay-put ov 'window (selected-window))))) (defun company-pseudo-tooltip-guard () - (list + (cons (save-excursion (beginning-of-visual-line)) - (let ((ov company-pseudo-tooltip-overlay)) + (let ((ov company-pseudo-tooltip-overlay) + (overhang (save-excursion (end-of-visual-line) + (- (line-end-position) (point))))) (when (>= (overlay-get ov 'company-height) 0) - (buffer-substring-no-properties (point) (overlay-start ov)))))) + (cons + (buffer-substring-no-properties (point) (overlay-start ov)) + (when (>= overhang 0) overhang)))))) (defun company-pseudo-tooltip-frontend (command) "`company-mode' front-end similar to a tooltip but based on overlays." -- 2.39.2