emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] shr-fontified 776705f 1/3: (shr-make-table-1): Add comment


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] shr-fontified 776705f 1/3: (shr-make-table-1): Add comments.
Date: Wed, 28 Jan 2015 02:22:58 +0000

branch: shr-fontified
commit 776705f49c5cb4e66c7dcb316fe499aa6a183888
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    (shr-make-table-1): Add comments.
---
 lisp/ChangeLog  |    1 +
 lisp/net/shr.el |   16 +++++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8af0ec4..1bb003c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,6 +1,7 @@
 2015-01-26  Lars Ingebrigtsen  <address@hidden>
 
        * net/shr.el (shr-make-table-1): Fix colspan typo.
+       (shr-make-table-1): Add comments.
 
        * net/eww.el (eww-add-bookmark): Fix prompt and clean up the code
        slightly.
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index a0c9eba..f4c765f 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1667,11 +1667,17 @@ The preference is a float determined from 
`shr-prefer-media-type'."
                                   ;; remaining columns.
                                   (- (length widths) i)))
                (dotimes (j (1- colspan))
-                 (if (> (+ i 1 j) (1- (length widths)))
-                     (setq width (aref widths (1- (length widths))))
-                   (setq width (+ width
-                                  shr-table-separator-length
-                                  (aref widths (+ i 1 j))))))
+                 (setq width
+                       (if (> (+ i 1 j) (1- (length widths)))
+                           ;; If we have a colspan spec that's longer
+                           ;; than the table is wide, just use the last
+                           ;; width as the width.
+                           (aref widths (1- (length widths)))
+                         ;; Sum up the widths of the columns we're
+                         ;; spanning.
+                         (+ width
+                            shr-table-separator-length
+                            (aref widths (+ i 1 j))))))
                (setq width-column (+ width-column (1- colspan))))
              (when (or column
                        (not fill))



reply via email to

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