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

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

[nongnu] elpa/visual-fill-column 5f5d816b5c 106/137: Correctly take widt


From: ELPA Syncer
Subject: [nongnu] elpa/visual-fill-column 5f5d816b5c 106/137: Correctly take width of line numbers into account.
Date: Sun, 2 Jan 2022 22:59:17 -0500 (EST)

branch: elpa/visual-fill-column
commit 5f5d816b5c2a2175d66e6aef7e27b1efa50ab3aa
Author: Joost Kremers <joostkremers@fastmail.fm>
Commit: Joost Kremers <joostkremers@fastmail.fm>

    Correctly take width of line numbers into account.
---
 visual-fill-column.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/visual-fill-column.el b/visual-fill-column.el
index 6ef64d135f..55742bbc3c 100644
--- a/visual-fill-column.el
+++ b/visual-fill-column.el
@@ -248,10 +248,10 @@ calls `visual-fill-column--adjust-window', but only if
 (defun visual-fill-column--window-max-text-width (&optional window)
   "Return the maximum possible text width of WINDOW.
 The maximum possible text width is the width of the current text
-area plus the margins, but excluding the fringes, scroll bar and
-right divider.  WINDOW defaults to the selected window.  The
-return value is scaled to account for `text-scale-mode-amount'
-and `text-scale-mode-step'."
+area plus the margins, but excluding the fringes, scroll bar,
+right divider, and line number width.  WINDOW defaults to the
+selected window.  The return value is scaled to account for
+`text-scale-mode-amount' and `text-scale-mode-step'."
   (or window (setq window (selected-window)))
   (let* ((margins (window-margins window))
          (buffer (window-buffer window))
@@ -264,10 +264,9 @@ and `text-scale-mode-step'."
     (truncate (/ (+ (window-width window)
                     (or (car margins) 0)
                     (or (cdr margins) 0)
-                    (or (and (boundp 'display-line-numbers-width)
-                             (numberp display-line-numbers-width)
-                             (- display-line-numbers-width))
-                        0))
+                    (if (fboundp 'line-number-display-width)
+                        (- (+ 2 (line-number-display-width)))
+                      0))
                  (float scale)))))
 
 (defun visual-fill-column--set-margins (window)



reply via email to

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