[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] shr-fontified 25f55f7 8/9: Don't infloop on unbreakable, i
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] shr-fontified 25f55f7 8/9: Don't infloop on unbreakable, indented lines |
Date: |
Mon, 09 Feb 2015 10:39:10 +0000 |
branch: shr-fontified
commit 25f55f76a6355b019479fb02398d12d3a25c915c
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>
Don't infloop on unbreakable, indented lines
---
lisp/net/shr.el | 43 +++++++++++++++++++++++++------------------
1 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 7a0c420..58d2e20 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -550,9 +550,11 @@ size, and full-buffer size."
(defun shr-fold-line ()
(let ((shr-indentation (get-text-property (point) 'shr-indentation))
(continuation (get-text-property
- (point) 'shr-continuation-indentation)))
+ (point) 'shr-continuation-indentation))
+ start)
(put-text-property (point) (1+ (point)) 'shr-indentation nil)
(shr-indent)
+ (setq start (point))
(setq shr-indentation (or continuation shr-indentation))
(shr-vertical-motion shr-internal-width)
(when (looking-at " $")
@@ -560,21 +562,23 @@ size, and full-buffer size."
(while (not (eolp))
;; We have to do some folding. First find the first
;; previous point suitable for folding.
- (if (not (shr-find-fill-point (line-beginning-position)))
+ (if (or (not (shr-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)
- (shr-indent)
- (search-forward " " (line-end-position) t))
- ;; Success; continue.
- (when (= (preceding-char) ?\s)
- (delete-char -1))
- (insert "\n")
- (shr-indent)
- (shr-vertical-motion shr-internal-width)
- (when (looking-at " $")
- (delete-region (point) (line-end-position)))))))
+ (skip-chars-forward " ")
+ (search-forward " " (line-end-position) 'move)))
+ ;; Success; continue.
+ (when (= (preceding-char) ?\s)
+ (delete-char -1))
+ (insert "\n")
+ (shr-indent)
+ (setq start (point))
+ (shr-vertical-motion shr-internal-width)
+ (when (looking-at " $")
+ (delete-region (point) (line-end-position))))))
(defun shr-find-fill-point (start)
(let ((bp (point))
@@ -1954,12 +1958,15 @@ The preference is a float determined from
`shr-prefer-media-type'."
(defun shr-dom-max-natural-width (dom max)
(if (eq (dom-tag dom) 'table)
- (max max (loop for line in (dom-attr dom 'shr-suggested-widths)
- maximize (+
- shr-table-separator-length
- (loop for elem in line
- summing (+ (cdr elem)
- (* 2
shr-table-separator-length))))))
+ (max max (or
+ (loop for line in (dom-attr dom 'shr-suggested-widths)
+ maximize (+
+ shr-table-separator-length
+ (loop for elem in line
+ summing
+ (+ (cdr elem)
+ (* 2 shr-table-separator-length)))))
+ 0))
(dolist (child (dom-children dom))
(unless (stringp child)
(setq max (max (shr-dom-max-natural-width child max)))))
- [Emacs-diffs] shr-fontified updated (70199c1 -> 35d95a2), Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified 1376a51 2/9: shr/Gnus face fixup and <li> rendering fix, Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified fe9660e 1/9: Rework the indentation to work more generally, Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified b0e3d92 3/9: (shr-fold-line): Handle lines that end with a space at the fill point., Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified 217e202 5/9: Further colspan fixes, Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified 659202a 6/9: Fix up last change to really get colspans right, Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified 8180e53 7/9: (shr-fold-line): Keep breaking unbreakable text., Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified 1d5d72e 4/9: shr filling fix-ups, Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified 25f55f7 8/9: Don't infloop on unbreakable, indented lines,
Lars Ingebrigtsen <=
- [Emacs-diffs] shr-fontified 35d95a2 9/9: (shr-insert-table): Expand table alignments in any buffer at the end., Lars Ingebrigtsen, 2015/02/09