[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ELPA-diffs] [elpa] 01/12: Fix #49
From: |
Dmitry Gutov |
Subject: |
[ELPA-diffs] [elpa] 01/12: Fix #49 |
Date: |
Sat, 25 Jan 2014 11:35:47 +0000 |
dgutov pushed a commit to branch master
in repository elpa.
commit e69b3e64d0b2575146a47aa47d573b48fa3c5254
Author: Dmitry Gutov <address@hidden>
Date: Thu Jan 23 03:54:28 2014 +0200
Fix #49
Adjust for window-width aberrations when Emacs runs in a terminal.
---
company.el | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/company.el b/company.el
index ec8a4a1..165ac64 100644
--- a/company.el
+++ b/company.el
@@ -1752,7 +1752,7 @@ Example: \(company-begin-with '\(\"foo\" \"foobar\"
\"foobarbaz\"\)\)"
(defun company--replacement-string (lines old column nl &optional align-top)
(let ((width (length (car lines)))
- (remaining-cols (- (+ (window-width) (window-hscroll))
+ (remaining-cols (- (+ (company--window-width) (window-hscroll))
column)))
(when (> width remaining-cols)
(decf column (- width remaining-cols))))
@@ -1804,7 +1804,7 @@ Example: \(company-begin-with '\(\"foo\" \"foobar\"
\"foobarbaz\"\)\)"
(dotimes (_ len)
(setq width (max (length (pop lines-copy)) width)))
- (setq width (min (window-width)
+ (setq width (min (company--window-width)
(if company-show-numbers
(+ 2 width)
width)))
@@ -1844,6 +1844,18 @@ Example: \(company-begin-with '\(\"foo\" \"foobar\"
\"foobarbaz\"\)\)"
(let ((edges (window-inside-edges)))
(- (nth 3 edges) (nth 1 edges))))
+(defsubst company--window-width ()
+ (- (window-width)
+ (cond
+ ((display-graphic-p) 0)
+ ;; Account for the line continuation column.
+ ((version< "24.3.1" emacs-version) 1)
+ ;; Emacs 24.3 and earlier included margins
+ ;; in window-width when in TTY.
+ (t (1+ (let ((margins (window-margins)))
+ (+ (or (car margins) 0)
+ (or (cdr margins) 0))))))))
+
(defun company--pseudo-tooltip-height ()
"Calculate the appropriate tooltip height.
Returns a negative number if the tooltip should be displayed above point."
- [ELPA-diffs] [elpa] branch master updated (324e000 -> c87035c), Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 06/12: company-select-mouse: update for when scrollbar is used, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 03/12: company--numbered-line: span tooltip face to the margins, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 01/12: Fix #49,
Dmitry Gutov <=
- [ELPA-diffs] [elpa] 08/12: company--create-lines: Clear the old offset when appropriate, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 07/12: company--create-lines: only reserve width for numbers when they'll be displayed, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 04/12: {cutoff, offset}, {numbered, position}-line, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 09/12: * company-capf.el (company--capf-data): Don't get confused by lambda exps., Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 10/12: Release 0.6.14, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 11/12: Remove leftover message statement, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 02/12: Render the popup with margins, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 05/12: Render scrollbar on the side of the tooltip, Dmitry Gutov, 2014/01/25
- [ELPA-diffs] [elpa] 12/12: Merge commit '8dc8f9525714db66f659a2a51322345068764bd3' from company, Dmitry Gutov, 2014/01/25