diff options
| author | Lars Ingebrigtsen | 2021-12-04 20:38:22 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-12-04 20:38:22 +0100 |
| commit | 08782d58db6437b593c0469372dc936f9d8a62da (patch) | |
| tree | 7b8c9d219e7eb575f3a6e1ceaff7dd84ebb2c78f | |
| parent | 3bfd8e4007868c1cccb3f7e0590c436d32de2146 (diff) | |
| download | emacs-08782d58db6437b593c0469372dc936f9d8a62da.tar.gz emacs-08782d58db6437b593c0469372dc936f9d8a62da.zip | |
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).
| -rw-r--r-- | lisp/textmodes/pixel-fill.el | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lisp/textmodes/pixel-fill.el b/lisp/textmodes/pixel-fill.el index f69696e1f56..0a0f0eb8b66 100644 --- a/lisp/textmodes/pixel-fill.el +++ b/lisp/textmodes/pixel-fill.el | |||
| @@ -116,15 +116,13 @@ prefix on subsequent lines." | |||
| 116 | (while (not (eolp)) | 116 | (while (not (eolp)) |
| 117 | ;; We have to do some folding. First find the first previous | 117 | ;; We have to do some folding. First find the first previous |
| 118 | ;; point suitable for folding. | 118 | ;; point suitable for folding. |
| 119 | (if (or (not (pixel-fill-find-fill-point (line-beginning-position))) | 119 | (when (or (not (pixel-fill-find-fill-point (line-beginning-position))) |
| 120 | (= (point) start)) | 120 | (= (point) start)) |
| 121 | ;; We had unbreakable text (for this width), so just go to | 121 | ;; We had unbreakable text (for this width), so just go to |
| 122 | ;; the first space and carry on. | 122 | ;; the first space and carry on. |
| 123 | (progn | 123 | (beginning-of-line) |
| 124 | (beginning-of-line) | 124 | (skip-chars-forward " ") |
| 125 | (skip-chars-forward " ") | 125 | (search-forward " " (line-end-position) 'move)) |
| 126 | (search-forward " " (line-end-position) 'move))) | ||
| 127 | ;; Success; continue. | ||
| 128 | (when (= (preceding-char) ?\s) | 126 | (when (= (preceding-char) ?\s) |
| 129 | (delete-char -1)) | 127 | (delete-char -1)) |
| 130 | (unless (eobp) | 128 | (unless (eobp) |
| @@ -133,7 +131,8 @@ prefix on subsequent lines." | |||
| 133 | (insert (propertize " " 'display | 131 | (insert (propertize " " 'display |
| 134 | (list 'space :align-to (list indentation)))))) | 132 | (list 'space :align-to (list indentation)))))) |
| 135 | (setq start (point)) | 133 | (setq start (point)) |
| 136 | (pixel-fill--goto-pixel width)))) | 134 | (unless (eobp) |
| 135 | (pixel-fill--goto-pixel width))))) | ||
| 137 | 136 | ||
| 138 | (define-inline pixel-fill--char-breakable-p (char) | 137 | (define-inline pixel-fill--char-breakable-p (char) |
| 139 | "Return non-nil if a line can be broken before and after CHAR." | 138 | "Return non-nil if a line can be broken before and after CHAR." |