From: Lars Magne Ingebrigtsen Date: Tue, 6 Aug 2013 22:05:33 +0000 (+0200) Subject: Further shr width computation fixes X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1686^2~399 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2122cb6dd2e1323963ebb2340078fc9f22e245e7;p=emacs.git Further shr width computation fixes (shr-make-table-1): Redo last change to fix the real problem in colspan handling. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 381ded5e697..666fab55bf4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 281ad3630a4..7eda2554e06 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1488,7 +1488,11 @@ ones, in case fg and bg are nil." 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 @@ ones, in case fg and bg are nil." 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 @@ ones, in case fg and bg are nil." (split-string (buffer-string) "\n") nil (car actual-colors)) - (max max 10)))))) + max))))) (defun shr-buffer-width () (goto-char (point-min))