]> granicus.if.org Git - python/commitdiff
Tim Peters writes:
authorGuido van Rossum <guido@python.org>
Mon, 13 Mar 2000 14:50:24 +0000 (14:50 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 13 Mar 2000 14:50:24 +0000 (14:50 +0000)
Fix bad auto-indent I recently introduced when replacing the regexp that
could cause re to blow up:

    if or_any_other_block_opener:
        # one indenting comment line
            ^ cursor ended up at the caret (the bug)
        ^ but belongs here (the post-patch behavior)

Tools/idle/PyParse.py

index 23b995c8edac9a51ff216bca7c4d930c22422121..40b672630344c9c5d17d603444427dbc72ece10e 100644 (file)
@@ -385,13 +385,14 @@ class Parser:
             m = _chew_ordinaryre(str, p, q)
             if m:
                 # we skipped at least one boring char
-                p = m.end()
+                newp = m.end()
                 # back up over totally boring whitespace
-                i = p-1    # index of last boring char
-                while i >= 0 and str[i] in " \t\n":
+                i = newp - 1    # index of last boring char
+                while i >= p and str[i] in " \t\n":
                     i = i-1
-                if i >= 0:
+                if i >= p:
                     lastch = str[i]
+                p = newp
                 if p >= q:
                     break