Hoist variable definition outside loop since it is used outside loop

This commit is contained in:
Kovid Goyal 2020-08-13 13:34:10 +05:30
parent ed21a72eae
commit bca1ef5767
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -878,9 +878,7 @@ def at_current(): # {{{
def at_point_vertical_mode(i, b): def at_point_vertical_mode(i, b):
return at_point(b, i) return at_point(b, i)
at_point_conditional = at_point at_point_conditional = at_point_vertical_mode if scroll_viewport.vertical_writing_mode else at_point
if scroll_viewport.vertical_writing_mode:
at_point_conditional = at_point_vertical_mode
def i_loop(curb): def i_loop(curb):
curi = starti curi = starti
@ -894,10 +892,9 @@ def at_current(): # {{{
curi += deltai curi += deltai
curb = startb curb = startb
while low_boundb <= curb <= up_boundb: cfi = None
while low_boundb <= curb <= up_boundb and not cfi:
cfi = i_loop(curb) cfi = i_loop(curb)
if cfi:
break
curb += deltab curb += deltab
if cfi: if cfi: