diff options
| author | Lars Magne Ingebrigtsen | 2013-08-06 23:28:38 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2013-08-06 23:28:38 +0200 |
| commit | ec6a2d7a5a0d308fc7f7c2cd20435766472ad394 (patch) | |
| tree | 10bad3597b4b7fba591bfe31b34a3035520d233a | |
| parent | 8bcced1f1217adc8058bc5ff6b00c640b668d94d (diff) | |
| download | emacs-ec6a2d7a5a0d308fc7f7c2cd20435766472ad394.tar.gz emacs-ec6a2d7a5a0d308fc7f7c2cd20435766472ad394.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2013-08-06 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * net/shr.el (shr-render-td): Remove debugging. | ||
| 4 | (shr-render-td): Make width computation consistent by defaulting | ||
| 5 | all zero-width columns to 10 characters. This may not be optimal, | ||
| 6 | but it's at least consistent. | ||
| 7 | |||
| 1 | 2013-08-06 Dmitry Antipov <dmantipov@yandex.ru> | 8 | 2013-08-06 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 9 | ||
| 3 | * files.el (cache-long-line-scans): Make | 10 | * 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." | |||
| 1496 | shr-table-separator-length | 1496 | shr-table-separator-length |
| 1497 | (aref widths (+ i 1 j)))))) | 1497 | (aref widths (+ i 1 j)))))) |
| 1498 | (setq width-column (+ width-column (1- colspan)))) | 1498 | (setq width-column (+ width-column (1- colspan)))) |
| 1499 | ;; Sanity check for degenerate tables. | ||
| 1500 | (when (zerop width) | ||
| 1501 | (setq width 10)) | ||
| 1499 | (when (or column | 1502 | (when (or column |
| 1500 | (not fill)) | 1503 | (not fill)) |
| 1501 | ;; Sanity check for degenerate tables. | ||
| 1502 | (when (zerop width) | ||
| 1503 | (setq width 10)) | ||
| 1504 | (push (shr-render-td (cdr column) width fill) | 1504 | (push (shr-render-td (cdr column) width fill) |
| 1505 | tds)) | 1505 | tds)) |
| 1506 | (setq i (1+ i) | 1506 | (setq i (1+ i) |
| @@ -1509,7 +1509,6 @@ ones, in case fg and bg are nil." | |||
| 1509 | (nreverse trs))) | 1509 | (nreverse trs))) |
| 1510 | 1510 | ||
| 1511 | (defun shr-render-td (cont width fill) | 1511 | (defun shr-render-td (cont width fill) |
| 1512 | (when (= width 0) (debug)) | ||
| 1513 | (with-temp-buffer | 1512 | (with-temp-buffer |
| 1514 | (let ((bgcolor (cdr (assq :bgcolor cont))) | 1513 | (let ((bgcolor (cdr (assq :bgcolor cont))) |
| 1515 | (fgcolor (cdr (assq :fgcolor cont))) | 1514 | (fgcolor (cdr (assq :fgcolor cont))) |
| @@ -1577,7 +1576,7 @@ ones, in case fg and bg are nil." | |||
| 1577 | (split-string (buffer-string) "\n") | 1576 | (split-string (buffer-string) "\n") |
| 1578 | nil | 1577 | nil |
| 1579 | (car actual-colors)) | 1578 | (car actual-colors)) |
| 1580 | max))))) | 1579 | (max max 10)))))) |
| 1581 | 1580 | ||
| 1582 | (defun shr-buffer-width () | 1581 | (defun shr-buffer-width () |
| 1583 | (goto-char (point-min)) | 1582 | (goto-char (point-min)) |