branch: elpa/page-break-lines
commit 6ba6789ba672dbf8e53bddbee41b8e20562ae0e2
Author: liuyinz <[email protected]>
Commit: liuyinz <[email protected]>

    fix: error when window width is extremely small
    
    The function window-max-chars-per-line may return -1 if the width of the 
current
    window is extremely small. When -1 is passed as the width value to 
make-list, it
    results in an error. We must ensure that the value is non-negative before 
passing it.
---
 page-break-lines.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/page-break-lines.el b/page-break-lines.el
index 934c97e2a0..28095799b1 100644
--- a/page-break-lines.el
+++ b/page-break-lines.el
@@ -129,7 +129,7 @@ its display table will be modified as necessary."
                                               (/ (float (string-pixel-width 
(make-string 100 page-break-lines-char)))
                                                  (string-pixel-width 
(make-string 100 ?a)))
                                             (char-width 
page-break-lines-char)))
-                     (width (floor (window-max-chars-per-line) 
char-relative-width))
+                     (width (floor (max 0 (window-max-chars-per-line)) 
char-relative-width))
                      (width (if page-break-lines-max-width
                                 (min width page-break-lines-max-width)
                               width))

Reply via email to