diff options
| author | Lars Magne Ingebrigtsen | 2013-08-07 00:05:33 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2013-08-07 00:05:33 +0200 |
| commit | 2122cb6dd2e1323963ebb2340078fc9f22e245e7 (patch) | |
| tree | 10767f91614c76f1f3d9191619163745214b6c9a | |
| parent | ec6a2d7a5a0d308fc7f7c2cd20435766472ad394 (diff) | |
| download | emacs-2122cb6dd2e1323963ebb2340078fc9f22e245e7.tar.gz emacs-2122cb6dd2e1323963ebb2340078fc9f22e245e7.zip | |
Further shr width computation fixes
(shr-make-table-1): Redo last change to fix the real problem in
colspan handling.
| -rw-r--r-- | lisp/ChangeLog | 2 | ||||
| -rw-r--r-- | lisp/net/shr.el | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 381ded5e697..666fab55bf4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -4,6 +4,8 @@ | |||
| 4 | (shr-render-td): Make width computation consistent by defaulting | 4 | (shr-render-td): Make width computation consistent by defaulting |
| 5 | all zero-width columns to 10 characters. This may not be optimal, | 5 | all zero-width columns to 10 characters. This may not be optimal, |
| 6 | but it's at least consistent. | 6 | but it's at least consistent. |
| 7 | (shr-make-table-1): Redo last change to fix the real problem in | ||
| 8 | colspan handling. | ||
| 7 | 9 | ||
| 8 | 2013-08-06 Dmitry Antipov <dmantipov@yandex.ru> | 10 | 2013-08-06 Dmitry Antipov <dmantipov@yandex.ru> |
| 9 | 11 | ||
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." | |||
| 1488 | 10)) | 1488 | 10)) |
| 1489 | (when (and fill | 1489 | (when (and fill |
| 1490 | (setq colspan (cdr (assq :colspan (cdr column))))) | 1490 | (setq colspan (cdr (assq :colspan (cdr column))))) |
| 1491 | (setq colspan (string-to-number colspan)) | 1491 | (setq colspan (min (string-to-number colspan) |
| 1492 | ;; The colspan may be wrong, so | ||
| 1493 | ;; truncate it to the length of the | ||
| 1494 | ;; remaining columns. | ||
| 1495 | (- (length widths) i))) | ||
| 1492 | (dotimes (j (1- colspan)) | 1496 | (dotimes (j (1- colspan)) |
| 1493 | (if (> (+ i 1 j) (1- (length widths))) | 1497 | (if (> (+ i 1 j) (1- (length widths))) |
| 1494 | (setq width (aref widths (1- (length widths)))) | 1498 | (setq width (aref widths (1- (length widths)))) |
| @@ -1496,9 +1500,6 @@ ones, in case fg and bg are nil." | |||
| 1496 | shr-table-separator-length | 1500 | shr-table-separator-length |
| 1497 | (aref widths (+ i 1 j)))))) | 1501 | (aref widths (+ i 1 j)))))) |
| 1498 | (setq width-column (+ width-column (1- colspan)))) | 1502 | (setq width-column (+ width-column (1- colspan)))) |
| 1499 | ;; Sanity check for degenerate tables. | ||
| 1500 | (when (zerop width) | ||
| 1501 | (setq width 10)) | ||
| 1502 | (when (or column | 1503 | (when (or column |
| 1503 | (not fill)) | 1504 | (not fill)) |
| 1504 | (push (shr-render-td (cdr column) width fill) | 1505 | (push (shr-render-td (cdr column) width fill) |
| @@ -1576,7 +1577,7 @@ ones, in case fg and bg are nil." | |||
| 1576 | (split-string (buffer-string) "\n") | 1577 | (split-string (buffer-string) "\n") |
| 1577 | nil | 1578 | nil |
| 1578 | (car actual-colors)) | 1579 | (car actual-colors)) |
| 1579 | (max max 10)))))) | 1580 | max))))) |
| 1580 | 1581 | ||
| 1581 | (defun shr-buffer-width () | 1582 | (defun shr-buffer-width () |
| 1582 | (goto-char (point-min)) | 1583 | (goto-char (point-min)) |