]> code.delx.au - gnu-emacs-elpa/commitdiff
Account for the line continuation column in graphical mode
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 30 Apr 2014 08:53:56 +0000 (12:53 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 30 Apr 2014 08:54:48 +0000 (12:54 +0400)
Fixes #104

company.el

index a9403cdc215d5e0f87c9b62b8b38b19a0387dde9..75c0f82cb82779e870cc4d9d693c75ea5863f135 100644 (file)
@@ -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.