[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 8d4ba7a 38/66: company-preview-show-at-point: Handle the p
From: |
Dmitry Gutov |
Subject: |
[elpa] master 8d4ba7a 38/66: company-preview-show-at-point: Handle the pseudo-tooltip-overlay |
Date: |
Tue, 13 Jan 2015 02:44:57 +0000 |
branch: master
commit 8d4ba7adac3d0358f0a0590243268585a79edd48
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
company-preview-show-at-point: Handle the pseudo-tooltip-overlay
Or rather, rendering at its beginning.
Fixes #267
---
company.el | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/company.el b/company.el
index efe3c32..e8ce966 100644
--- a/company.el
+++ b/company.el
@@ -2528,8 +2528,6 @@ Returns a negative number if the tooltip should be
displayed above point."
(defun company-preview-show-at-point (pos)
(company-preview-hide)
- (setq company-preview-overlay (make-overlay pos pos))
-
(let ((completion (nth company-selection company-candidates)))
(setq completion (propertize completion 'face 'company-preview))
(add-text-properties 0 (length company-common)
@@ -2547,11 +2545,25 @@ Returns a negative number if the tooltip should be
displayed above point."
(and (equal pos (point))
(not (equal completion ""))
- (add-text-properties 0 1 '(cursor t) completion))
-
- (let ((ov company-preview-overlay))
- (overlay-put ov 'after-string completion)
- (overlay-put ov 'window (selected-window)))))
+ (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)))))
+ ;; Try to accomodate for the pseudo-tooltip overlay,
+ ;; which may start at the same position if it's at eol.
+ (when ptf-workaround
+ (cl-decf beg)
+ (setq completion (concat (buffer-substring beg pos) completion)))
+
+ (setq company-preview-overlay (make-overlay beg pos))
+
+ (let ((ov company-preview-overlay))
+ (overlay-put ov (if ptf-workaround 'display 'after-string)
+ completion)
+ (overlay-put ov 'window (selected-window))))))
(defun company-preview-hide ()
(when company-preview-overlay
- [elpa] master 0cdcd07 27/66: company-capf: Pass `sole' or 'finished' to exit-function, not `exact', (continued)
- [elpa] master 0cdcd07 27/66: company-capf: Pass `sole' or 'finished' to exit-function, not `exact', Dmitry Gutov, 2015/01/12
- [elpa] master cecf6a9 29/66: company--window-width: Make it a defun, Dmitry Gutov, 2015/01/12
- [elpa] master 8196ff6 30/66: Work around http://debbugs.gnu.org/18384, Dmitry Gutov, 2015/01/12
- [elpa] master 62d1f37 28/66: company-clang--start-process: Bind process-adaptive-read-buffering to nil, Dmitry Gutov, 2015/01/12
- [elpa] master 3b622c4 31/66: Define customize group for company-bbdb, Dmitry Gutov, 2015/01/12
- [elpa] master e7073a1 33/66: s/`bbdb'/BBDB, Dmitry Gutov, 2015/01/12
- [elpa] master 996fbd2 24/66: Add company-bbdb-modes defcustom, Dmitry Gutov, 2015/01/12
- [elpa] master 8d61f1b 35/66: company-semantic: add simple annotations, Dmitry Gutov, 2015/01/12
- [elpa] master ed97b73 34/66: company--insert-candidate: Don't change buffer modification status unnecessarily, Dmitry Gutov, 2015/01/12
- [elpa] master 6d023fd 36/66: Add NEWS entry, Dmitry Gutov, 2015/01/12
- [elpa] master 8d4ba7a 38/66: company-preview-show-at-point: Handle the pseudo-tooltip-overlay,
Dmitry Gutov <=
- [elpa] master bd5e453 39/66: #267 follow-up fixes, Dmitry Gutov, 2015/01/12
- [elpa] master 7ac956a 37/66: Fix typo, Dmitry Gutov, 2015/01/12
- [elpa] master ccecb37 32/66: Merge pull request #252 from markus1189/bbdb-customize-group, Dmitry Gutov, 2015/01/12
- [elpa] master 6ff5ed3 40/66: Clear out unused variable warnings, Dmitry Gutov, 2015/01/12
- [elpa] master 8b587c0 43/66: Add .elpaignore, Dmitry Gutov, 2015/01/12
- [elpa] master eef07a5 44/66: Support template functions in company-clang annotations, Dmitry Gutov, 2015/01/12
- [elpa] master 80620a1 45/66: Remove ineffective change from c6e9fbad312fc62876d40032a84a94439a055d05, Dmitry Gutov, 2015/01/12
- [elpa] master 829b40f 46/66: company--continue-failed: Don't burp on `stop', Dmitry Gutov, 2015/01/12
- [elpa] master 0a172c5 47/66: company-search-map: Support keypad numbers, Dmitry Gutov, 2015/01/12
- [elpa] master ff9bafc 41/66: Don't idle-begin when company-candidates is non-nil, Dmitry Gutov, 2015/01/12