From bca1ef5767477f4fe621b16cb5e79713bdba2004 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 13 Aug 2020 13:34:10 +0530 Subject: [PATCH] Hoist variable definition outside loop since it is used outside loop --- src/pyj/read_book/cfi.pyj | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pyj/read_book/cfi.pyj b/src/pyj/read_book/cfi.pyj index 909b88d128..02d60d64b1 100644 --- a/src/pyj/read_book/cfi.pyj +++ b/src/pyj/read_book/cfi.pyj @@ -878,9 +878,7 @@ def at_current(): # {{{ def at_point_vertical_mode(i, b): return at_point(b, i) - at_point_conditional = at_point - if scroll_viewport.vertical_writing_mode: - at_point_conditional = at_point_vertical_mode + at_point_conditional = at_point_vertical_mode if scroll_viewport.vertical_writing_mode else at_point def i_loop(curb): curi = starti @@ -894,10 +892,9 @@ def at_current(): # {{{ curi += deltai curb = startb - while low_boundb <= curb <= up_boundb: + cfi = None + while low_boundb <= curb <= up_boundb and not cfi: cfi = i_loop(curb) - if cfi: - break curb += deltab if cfi: