[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 03/05: company-pseudo-tooltip-guard: Handle wrapped lines
From: |
Dmitry Gutov |
Subject: |
[elpa] 03/05: company-pseudo-tooltip-guard: Handle wrapped lines |
Date: |
Sun, 14 Sep 2014 07:06:24 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit c7b852f8d52b090c696311b2b577bb7442c26de4
Author: Dmitry Gutov <address@hidden>
Date: Sun Sep 14 02:39:06 2014 +0400
company-pseudo-tooltip-guard: Handle wrapped lines
---
company.el | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/company.el b/company.el
index 39c120b..504fa0f 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."