mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-03 08:30:09 +00:00
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).
This commit is contained in:
parent
3bfd8e4007
commit
08782d58db
@ -116,15 +116,13 @@ prefix on subsequent lines."
|
|||||||
(while (not (eolp))
|
(while (not (eolp))
|
||||||
;; We have to do some folding. First find the first previous
|
;; We have to do some folding. First find the first previous
|
||||||
;; point suitable for folding.
|
;; point suitable for folding.
|
||||||
(if (or (not (pixel-fill-find-fill-point (line-beginning-position)))
|
(when (or (not (pixel-fill-find-fill-point (line-beginning-position)))
|
||||||
(= (point) start))
|
(= (point) start))
|
||||||
;; We had unbreakable text (for this width), so just go to
|
;; We had unbreakable text (for this width), so just go to
|
||||||
;; the first space and carry on.
|
;; the first space and carry on.
|
||||||
(progn
|
(beginning-of-line)
|
||||||
(beginning-of-line)
|
(skip-chars-forward " ")
|
||||||
(skip-chars-forward " ")
|
(search-forward " " (line-end-position) 'move))
|
||||||
(search-forward " " (line-end-position) 'move)))
|
|
||||||
;; Success; continue.
|
|
||||||
(when (= (preceding-char) ?\s)
|
(when (= (preceding-char) ?\s)
|
||||||
(delete-char -1))
|
(delete-char -1))
|
||||||
(unless (eobp)
|
(unless (eobp)
|
||||||
@ -133,7 +131,8 @@ prefix on subsequent lines."
|
|||||||
(insert (propertize " " 'display
|
(insert (propertize " " 'display
|
||||||
(list 'space :align-to (list indentation))))))
|
(list 'space :align-to (list indentation))))))
|
||||||
(setq start (point))
|
(setq start (point))
|
||||||
(pixel-fill--goto-pixel width))))
|
(unless (eobp)
|
||||||
|
(pixel-fill--goto-pixel width)))))
|
||||||
|
|
||||||
(define-inline pixel-fill--char-breakable-p (char)
|
(define-inline pixel-fill--char-breakable-p (char)
|
||||||
"Return non-nil if a line can be broken before and after CHAR."
|
"Return non-nil if a line can be broken before and after CHAR."
|
||||||
|
Loading…
Reference in New Issue
Block a user