emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 11/28: Use window-screen-lines when available


From: Dmitry Gutov
Subject: [elpa] 11/28: Use window-screen-lines when available
Date: Wed, 27 Aug 2014 01:26:25 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit 308cf47d1533234b9fe2261a60e90048802ced53
Author: Dmitry Gutov <address@hidden>
Date:   Wed Aug 6 08:35:00 2014 +0400

    Use window-screen-lines when available
    
    Fixes #160
---
 NEWS.md    |    1 +
 company.el |    7 ++++++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 33e1e68..e2a5c48 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,7 @@
 
 # Next
 
+* On Emacs 24.4 or newer, tooltip positioning takes line-spacing into account.
 * New face `company-tooltip-search`, used for the search string in the tooltip.
 * The default value of `company-dabbrev-minimum-length` is set to 4, 
independent
   of what `company-minimum-prefix-length` is set to.
diff --git a/company.el b/company.el
index 7d5ec8c..4b59655 100644
--- a/company.el
+++ b/company.el
@@ -2363,6 +2363,11 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
 
 ;; show
 
+(defsubst company--window-height ()
+  (if (fboundp 'window-screen-lines)
+      (floor (window-screen-lines))
+    (window-body-height)))
+
 (defsubst company--window-width ()
   (let ((ww (window-body-width)))
     ;; Account for the line continuation column.
@@ -2382,7 +2387,7 @@ If SHOW-VERSION is non-nil, show the version in the echo 
area."
   "Calculate the appropriate tooltip height.
 Returns a negative number if the tooltip should be displayed above point."
   (let* ((lines (company--row))
-         (below (- (window-body-height) 1 lines)))
+         (below (- (company--window-height) 1 lines)))
     (if (and (< below (min company-tooltip-minimum company-candidates-length))
              (> lines below))
         (- (max 3 (min company-tooltip-limit lines)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]