1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-24 10:38:38 +00:00

Avoid reordering of output in 'shr-insert-document'

* lisp/net/shr.el (shr-string-pixel-width): Preserve point across
shr-pixel-column invocations.  (Bug#29734)
This commit is contained in:
Eli Zaretskii 2017-12-16 16:09:41 +02:00
parent 7890864413
commit f274cbd185

View File

@ -591,9 +591,14 @@ size, and full-buffer size."
(defun shr-string-pixel-width (string)
(if (not shr-use-fonts)
(length string)
(with-temp-buffer
(insert string)
(shr-pixel-column))))
;; Save and restore point across with-temp-buffer, since
;; shr-pixel-column uses save-window-excursion, which can reset
;; point to 1.
(let ((pt (point)))
(with-temp-buffer
(insert string)
(shr-pixel-column))
(goto-char pt))))
(defsubst shr--translate-insertion-chars ()
;; Remove soft hyphens.