Skip to content

Commit

Permalink
fix: error when window width is extremely small
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eki3z committed Sep 11, 2024
1 parent e33426a commit 6ba6789
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion page-break-lines.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 6ba6789

Please sign in to comment.