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

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

[elpa] 07/52: Account for the line continuation column in graphical mode


From: Dmitry Gutov
Subject: [elpa] 07/52: Account for the line continuation column in graphical mode
Date: Tue, 01 Jul 2014 11:53:06 +0000

dgutov pushed a commit to branch master
in repository elpa.

commit 0cbd7228ae70abe6c76c9783a3a451f43b652af1
Author: Dmitry Gutov <address@hidden>
Date:   Wed Apr 30 12:53:56 2014 +0400

    Account for the line continuation column in graphical mode
    
    Fixes #104
---
 company.el |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/company.el b/company.el
index a9403cd..75c0f82 100644
--- a/company.el
+++ b/company.el
@@ -2271,16 +2271,19 @@ If SHOW-VERSION is non-nil, show the version in the 
echo area."
     (- (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)
+  (let ((ww (window-width)))
+    ;; Account for the line continuation column.
+    (when (zerop (cadr (window-fringes)))
+      (cl-decf ww))
+    (unless (or (display-graphic-p)
+                (version< "24.3.1" emacs-version))
       ;; 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))))))))
+      (cl-decf ww
+               (let ((margins (window-margins)))
+                 (+ (or (car margins) 0)
+                    (or (cdr margins) 0)))))
+    ww))
 
 (defun company--pseudo-tooltip-height ()
   "Calculate the appropriate tooltip height.



reply via email to

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