[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)))
- [elpa] branch master updated (b6a1a9e -> 2d6cddf), Dmitry Gutov, 2014/08/26
- [elpa] 01/28: company-fill-propertize: tuncate the common part, Dmitry Gutov, 2014/08/26
- [elpa] 03/28: company-dabbrev-minimum-length: change the initvalue and document better, Dmitry Gutov, 2014/08/26
- [elpa] 06/28: Use `window-body-width' instead of the now-alias `window-width', Dmitry Gutov, 2014/08/26
- [elpa] 07/28: company--window-inner-height: remove, use `window-body-height', Dmitry Gutov, 2014/08/26
- [elpa] 02/28: company-dabbrev--search-buffer: Use `syntax-ppss' to get to the beg of str-or-cmt, Dmitry Gutov, 2014/08/26
- [elpa] 04/28: Remove the "download ERT" logic; should be unused at this point, Dmitry Gutov, 2014/08/26
- [elpa] 08/28: Assign a face for the tooltip search string, Dmitry Gutov, 2014/08/26
- [elpa] 09/28: Merge pull request #164 from holomorph/tooltip-search, Dmitry Gutov, 2014/08/26
- [elpa] 10/28: Mention company-tooltip-search in NEWS, Dmitry Gutov, 2014/08/26
- [elpa] 11/28: Use window-screen-lines when available,
Dmitry Gutov <=
- [elpa] 05/28: company--show-inline-p: never ignore case, Dmitry Gutov, 2014/08/26
- [elpa] 12/28: Tweak wording, Dmitry Gutov, 2014/08/26
- [elpa] 13/28: Use `posn-actual-col-row' to determine the current col and row, Dmitry Gutov, 2014/08/26
- [elpa] 14/28: Work around http://debbugs.gnu.org/18285, Dmitry Gutov, 2014/08/26
- [elpa] 16/28: company-buffer-lines: handle multiline display better, Dmitry Gutov, 2014/08/26
- [elpa] 17/28: company-input-noop still seems to be needed in the terminal, Dmitry Gutov, 2014/08/26
- [elpa] 18/28: Skip company-buffer-lines tests in terminal, Dmitry Gutov, 2014/08/26
- [elpa] 19/28: company-pseudo-tooltip-unhide: use local vars, Dmitry Gutov, 2014/08/26
- [elpa] 20/28: company-pseudo-tooltip-unhide: fix rendering at eob, Dmitry Gutov, 2014/08/26
- [elpa] 15/28: Fix the tests, Dmitry Gutov, 2014/08/26