8000 improve prev_char loop · astrofrog/matplotlib@acf73c2 · GitHub
[go: up one dir, main page]

Skip to content

Commit acf73c2

Browse files
committed
improve prev_char loop
1 parent 98bd2e4 commit acf73c2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/matplotlib/mathtext.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,11 +2501,10 @@ def symbol(self, s, loc, toks):
25012501
if c in self._spaced_symbols:
25022502
# iterate until we find previous character, needed for cases
25032503
# such as ${ -2}$, $ -2$, or $ -2$.
2504-
i = 1
2505-
prev_char = s[loc-i]
2506-
while prev_char == ' ' and i <= loc:
2507-
i += 1
2504+
for i in six.moves.xrange(1, loc + 1):
25082505
prev_char = s[loc-i]
2506+
if prev_char != ' ':
2507+
break
25092508
# Binary operators at start of string should not be spaced
25102509
if (c in self._binary_operators and
25112510
(len(s[:loc].split()) == 0 or prev_char == '{')):

0 commit comments

Comments
 (0)
0