emacs-diffs
[Top][All Lists]
Advanced

[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



reply via email to

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