From 043f9a5b885960cf0f27fad90cf758013b2ea113 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 11 Sep 2019 16:54:03 +0530 Subject: [PATCH] Workaround for error in scroll_to() on some japanese books with vertical text --- src/pyj/read_book/cfi.pyj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/cfi.pyj b/src/pyj/read_book/cfi.pyj index d913e78f5f..3d5b62a17d 100644 --- a/src/pyj/read_book/cfi.pyj +++ b/src/pyj/read_book/cfi.pyj @@ -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]