From ec6a2d7a5a0d308fc7f7c2cd20435766472ad394 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Tue, 6 Aug 2013 23:28:38 +0200 Subject: [PATCH] shr table rendering touch-ups * net/shr.el (shr-render-td): Remove debugging. (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. --- lisp/ChangeLog | 7 +++++++ lisp/net/shr.el | 9 ++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5f243b82e04..381ded5e697 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2013-08-06 Lars Magne Ingebrigtsen + + * net/shr.el (shr-render-td): Remove debugging. + (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. + 2013-08-06 Dmitry Antipov * files.el (cache-long-line-scans): Make diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 89791511e09..281ad3630a4 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1496,11 +1496,11 @@ 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)) - ;; Sanity check for degenerate tables. - (when (zerop width) - (setq width 10)) (push (shr-render-td (cdr column) width fill) tds)) (setq i (1+ i) @@ -1509,7 +1509,6 @@ ones, in case fg and bg are nil." (nreverse trs))) (defun shr-render-td (cont width fill) - (when (= width 0) (debug)) (with-temp-buffer (let ((bgcolor (cdr (assq :bgcolor cont))) (fgcolor (cdr (assq :fgcolor cont))) @@ -1577,7 +1576,7 @@ ones, in case fg and bg are nil." (split-string (buffer-string) "\n") nil (car actual-colors)) - max))))) + (max max 10)))))) (defun shr-buffer-width () (goto-char (point-min)) -- 2.39.2