dgutov pushed a commit to branch master
in repository elpa.
commit 9b0d457335957532ae65118cdc76d9126658ae42
Author: Dmitry Gutov <[email protected]>
Date: Sat Feb 1 05:12:09 2014 +0200
Render company-preview-frontend after the cursor
---
NEWS.md | 1 +
company.el | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/NEWS.md b/NEWS.md
index 309b915..8957912 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
## Next
+* `company-preview-frontend` renders itself after the cursor.
* New user option `company-transformers`.
* First transformer, `company-sort-by-occurrence`.
* New user options controlling `company-dabbrev` and `company-dabbrev-code`.
diff --git a/company.el b/company.el
index 2d68059..e43dd74 100644
--- a/company.el
+++ b/company.el
@@ -2120,9 +2120,9 @@ 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))
+ (setq company-preview-overlay (make-overlay pos (1+ pos)))
- (let ((completion(nth company-selection company-candidates)))
+ (let ((completion (nth company-selection company-candidates)))
(setq completion (propertize completion 'face 'company-preview))
(add-text-properties 0 (length company-common)
'(face company-preview-common) completion)
@@ -2141,7 +2141,9 @@ Returns a negative number if the tooltip should be
displayed above point."
(not (equal completion ""))
(add-text-properties 0 1 '(cursor t) completion))
- (overlay-put company-preview-overlay 'after-string completion)
+ (overlay-put company-preview-overlay 'display
+ (concat completion (unless (eq pos (point-max))
+ (buffer-substring pos (1+ pos)))))
(overlay-put company-preview-overlay 'window (selected-window))))
(defun company-preview-hide ()