]> code.delx.au - gnu-emacs-elpa/commitdiff
Introduce company-tooltip-flip-when-above
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 28 May 2014 23:54:09 +0000 (02:54 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 28 May 2014 23:54:09 +0000 (02:54 +0300)
Closes #116

NEWS.md
company.el

diff --git a/NEWS.md b/NEWS.md
index 6206a36f8fc53f41764eb050e41167534a787384..6db3e2163f575cbe0847431cee9748bbfcc08b15 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -3,6 +3,7 @@
 ## Next
 
 * `company-clang` uses the standard header search paths by default.
+* New user option `company-tooltip-flip-when-above`.
 
 ## 2014-04-19 (0.8.0)
 
index 580304e8b989c2665f23c0b93353dce00e5e78ec..bbe15c1988c310eff8958747a97e099f02441cf7 100644 (file)
@@ -264,6 +264,10 @@ This doesn't include the margins and the scroll bar."
   "When non-nil, align annotations to the right tooltip border."
   :type 'boolean)
 
+(defcustom company-tooltip-flip-when-above nil
+  "Whether to flip the tooltip when it's above the current line."
+  :type 'boolean)
+
 (defvar company-safe-backends
   '((company-abbrev . "Abbrev")
     (company-bbdb . "BBDB")
@@ -2121,6 +2125,9 @@ If SHOW-VERSION is non-nil, show the version in the echo area."
 (defun company--replacement-string (lines old column nl &optional align-top)
   (cl-decf column company-tooltip-margin)
 
+  (when (and align-top company-tooltip-flip-when-abovex)
+    (setq lines (reverse lines)))
+
   (let ((width (length (car lines)))
         (remaining-cols (- (+ (company--window-width) (window-hscroll))
                            column)))