From: Eli Zaretskii <eliz@gnu.org>
Date: Thu, 31 Dec 2015 15:18:25 +0000 (+0200)
Subject: Fix EWW rendering of long RTL lines
X-Git-Tag: emacs-25.0.90~306
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bb83bb11f9c38199e413045300acf6ef04f67b4a;p=emacs.git

Fix EWW rendering of long RTL lines

* lisp/net/shr.el (shr-insert-document): Undo any previous hscroll
of the selected window before filling its lines.  (Bug#22250)
---

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 330f7b5d84b..09e368f8b47 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -246,6 +246,11 @@ DOM should be a parse tree as generated by
                                          (* (frame-char-width) 2)
                                        0)))))
         bidi-display-reordering)
+    ;; If the window was hscrolled for some reason, shr-fill-lines
+    ;; below will misbehave, because it silently assumes that it
+    ;; starts with a non-hscrolled window (vertical-motion will move
+    ;; to a wrong place otherwise).
+    (set-window-hscroll nil 0)
     (shr-descend dom)
     (shr-fill-lines start (point))
     (shr-remove-trailing-whitespace start (point))