emacs-diffs
[Top][All Lists]
Advanced

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

master 08782d5: Fix pixel-fill--fill-line infloop for certain unbreakabl


From: Lars Ingebrigtsen
Subject: master 08782d5: Fix pixel-fill--fill-line infloop for certain unbreakable lines
Date: Sat, 4 Dec 2021 14:38:38 -0500 (EST)

branch: master
commit 08782d58db6437b593c0469372dc936f9d8a62da
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix pixel-fill--fill-line infloop for certain unbreakable lines
    
    * lisp/textmodes/pixel-fill.el (pixel-fill--fill-line): Fix
    infloops for certain line widths (bug#52271).
---
 lisp/textmodes/pixel-fill.el | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/lisp/textmodes/pixel-fill.el b/lisp/textmodes/pixel-fill.el
index f69696e..0a0f0eb 100644
--- a/lisp/textmodes/pixel-fill.el
+++ b/lisp/textmodes/pixel-fill.el
@@ -116,15 +116,13 @@ prefix on subsequent lines."
     (while (not (eolp))
       ;; We have to do some folding.  First find the first previous
       ;; point suitable for folding.
-      (if (or (not (pixel-fill-find-fill-point (line-beginning-position)))
-             (= (point) start))
-         ;; We had unbreakable text (for this width), so just go to
-         ;; the first space and carry on.
-         (progn
-           (beginning-of-line)
-           (skip-chars-forward " ")
-           (search-forward " " (line-end-position) 'move)))
-      ;; Success; continue.
+      (when (or (not (pixel-fill-find-fill-point (line-beginning-position)))
+               (= (point) start))
+       ;; We had unbreakable text (for this width), so just go to
+       ;; the first space and carry on.
+       (beginning-of-line)
+       (skip-chars-forward " ")
+       (search-forward " " (line-end-position) 'move))
       (when (= (preceding-char) ?\s)
        (delete-char -1))
       (unless (eobp)
@@ -133,7 +131,8 @@ prefix on subsequent lines."
           (insert (propertize " " 'display
                               (list 'space :align-to (list indentation))))))
       (setq start (point))
-      (pixel-fill--goto-pixel width))))
+      (unless (eobp)
+        (pixel-fill--goto-pixel width)))))
 
 (define-inline pixel-fill--char-breakable-p (char)
   "Return non-nil if a line can be broken before and after CHAR."



reply via email to

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