shr.el (shr-tag-img): Use string-width and truncate-string-to-width to measure the length and truncate alt text.

This commit is contained in:
Katsumi Yamaoka 2010-11-04 11:00:25 +00:00
parent 015eea5996
commit b354bc5303
2 changed files with 7 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2010-11-04 Katsumi Yamaoka <yamaoka@jpl.org>
* shr.el (shr-tag-img): Use string-width and truncate-string-to-width
to measure the length and truncate alt text.
2010-11-03 Glenn Morris <rgm@gnu.org>
* nndiary.el (nndiary-generate-nov-databases-1)

View file

@ -551,8 +551,8 @@ Return a string with image data."
(string-match shr-blocked-images url)))
(setq shr-start (point))
(let ((shr-state 'space))
(if (> (length alt) 8)
(shr-insert (substring alt 0 8))
(if (> (string-width alt) 8)
(shr-insert (truncate-string-to-width alt 8))
(shr-insert alt))))
((url-is-cached (shr-encode-url url))
(shr-put-image (shr-get-image-data url) alt))