[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] shr-fontified 1d5d72e 4/9: shr filling fix-ups
From: |
Lars Ingebrigtsen |
Subject: |
[Emacs-diffs] shr-fontified 1d5d72e 4/9: shr filling fix-ups |
Date: |
Mon, 09 Feb 2015 10:39:08 +0000 |
branch: shr-fontified
commit 1d5d72efa8b4766a75ab6f98ee0fe4d84b896290
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>
shr filling fix-ups
(shr-pixel-region): New function.
(shr-fold-lines): Don't re-fold sections that didn't need to be
folded.
---
lisp/ChangeLog | 3 +++
lisp/net/shr.el | 13 ++++++++++---
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 821a6e0..71d1223 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,9 @@
* net/shr.el (shr-fold-line): Indent <li> properly.
(shr-fold-line): Handle lines that end with a space at the fill point.
+ (shr-pixel-region): New function.
+ (shr-fold-lines): Don't re-fold sections that didn't need to be
+ folded.
2015-02-08 Lars Ingebrigtsen <address@hidden>
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index beea267..eb3df1f 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -477,6 +477,12 @@ size, and full-buffer size."
(car (window-text-pixel-size nil (line-beginning-position) (point))))
(car (window-text-pixel-size nil (line-beginning-position) (point))))))
+(defun shr-pixel-region ()
+ (- (shr-pixel-column)
+ (save-excursion
+ (goto-char (mark))
+ (shr-pixel-column))))
+
(defun shr-string-pixel-width (string)
(if (not shr-use-fonts)
(length string)
@@ -528,7 +534,8 @@ size, and full-buffer size."
(shr-fold-line))
(while (setq start (next-single-property-change start 'shr-indentation))
(goto-char start)
- (shr-fold-line))
+ (when (bolp)
+ (shr-fold-line)))
(goto-char (point-max)))))
(defun shr-vertical-motion (column)
@@ -1739,7 +1746,7 @@ The preference is a float determined from
`shr-prefer-media-type'."
(setq i (1+ i)))))
(let ((extra (- (apply '+ (append suggested-widths nil))
(apply '+ (append widths nil))
- (* shr-table-separator-pixel-width 2)))
+ (* shr-table-separator-pixel-width (length widths))))
(expanded-columns 0))
;; We have extra, unused space, so divide this space amongst the
;; columns.
@@ -1802,7 +1809,7 @@ The preference is a float determined from
`shr-prefer-media-type'."
(setq width
(if column
(aref widths width-column)
- 140))
+ (* 10 shr-table-separator-pixel-width)))
(when (setq colspan (dom-attr column 'colspan))
(setq colspan (min (string-to-number colspan)
;; The colspan may be wrong, so
- [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 <=
- [Emacs-diffs] shr-fontified 25f55f7 8/9: Don't infloop on unbreakable, indented lines, Lars Ingebrigtsen, 2015/02/09
- [Emacs-diffs] shr-fontified 35d95a2 9/9: (shr-insert-table): Expand table alignments in any buffer at the end., Lars Ingebrigtsen, 2015/02/09