emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r113724: Further shr width computation fixes


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] trunk r113724: Further shr width computation fixes
Date: Tue, 06 Aug 2013 22:05:35 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113724
revision-id: address@hidden
parent: address@hidden
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2013-08-07 00:05:33 +0200
message:
  Further shr width computation fixes
  
  (shr-make-table-1): Redo last change to fix the real problem in
  colspan handling.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/net/shr.el                shr.el-20101002102929-yfzewk55rsg0mn93-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-08-06 21:28:38 +0000
+++ b/lisp/ChangeLog    2013-08-06 22:05:33 +0000
@@ -4,6 +4,8 @@
        (shr-render-td): Make width computation consistent by defaulting
        all zero-width columns to 10 characters.  This may not be optimal,
        but it's at least consistent.
+       (shr-make-table-1): Redo last change to fix the real problem in
+       colspan handling.
 
 2013-08-06  Dmitry Antipov  <address@hidden>
 

=== modified file 'lisp/net/shr.el'
--- a/lisp/net/shr.el   2013-08-06 21:28:38 +0000
+++ b/lisp/net/shr.el   2013-08-06 22:05:33 +0000
@@ -1488,7 +1488,11 @@
                      10))
              (when (and fill
                         (setq colspan (cdr (assq :colspan (cdr column)))))
-               (setq colspan (string-to-number colspan))
+               (setq colspan (min (string-to-number colspan)
+                                  ;; The colspan may be wrong, so
+                                  ;; truncate it to the length of the
+                                  ;; remaining columns.
+                                  (- (length widths) i)))
                (dotimes (j (1- colspan))
                  (if (> (+ i 1 j) (1- (length widths)))
                      (setq width (aref widths (1- (length widths))))
@@ -1496,9 +1500,6 @@
                                   shr-table-separator-length
                                   (aref widths (+ i 1 j))))))
                (setq width-column (+ width-column (1- colspan))))
-             ;; Sanity check for degenerate tables.
-             (when (zerop width)
-               (setq width 10))
              (when (or column
                        (not fill))
                (push (shr-render-td (cdr column) width fill)
@@ -1576,7 +1577,7 @@
                  (split-string (buffer-string) "\n")
                  nil
                  (car actual-colors))
-         (max max 10))))))
+         max)))))
 
 (defun shr-buffer-width ()
   (goto-char (point-min))


reply via email to

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