Workaround for error in scroll_to() on some japanese books with vertical text

This commit is contained in:
Kovid Goyal 2019-09-11 16:54:03 +05:30
parent 2dd562b731
commit 043f9a5b88
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -540,7 +540,11 @@ def scroll_to(cfi, callback, doc): # {{{
# Reset the range to what it was before the span was added
r.setStart(sc, so)
r.setEnd(ec, eo)
try:
r.setEnd(ec, eo)
except:
# this happens for some japanese books
r.setEnd(ec, eo-1)
rects = r.getClientRects()
if rects.length > 0:
rect = rects[0]