[Patches] Fix to IDLE PyParse.py fix

Tim Peters tim_one@email.msn.com
Sun, 12 Mar 2000 03:41:17 -0500


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)




I confirm that, to the best of my knowledge and belief, this
contribution is free of any claims of third parties under
copyright, patent or other rights or interests ("claims").  To
the extent that I have any such claims, I hereby grant to CNRI a
nonexclusive, irrevocable, royalty-free, worldwide license to
reproduce, distribute, perform and/or display publicly, prepare
derivative versions, and otherwise use this contribution as part
of the Python software and its related documentation, or any
derivative versions thereof, at no cost to CNRI or its licensed
users, and to authorize others to do so.

I acknowledge that CNRI may, at its sole discretion, decide
whether or not to incorporate this contribution in the Python
software and its related documentation.  I further grant CNRI
permission to use my name and other identifying information
provided to CNRI by me for use in connection with the Python
software and its related documentation.



*** idle/old/PyParse.py	Mon Mar 06 20:48:32 2000
--- idle/PyParse.py	Sun Mar 12 03:21:38 2000
***************
*** 385,397 ****
              m = _chew_ordinaryre(str, p, q)
              if m:
                  # we skipped at least one boring char
!                 p = 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 = i-1
!                 if i >= 0:
                      lastch = str[i]
                  if p >= q:
                      break

--- 385,398 ----
              m = _chew_ordinaryre(str, p, q)
              if m:
                  # we skipped at least one boring char
!                 newp = m.end()
                  # back up over totally boring whitespace
!                 i = newp - 1    # index of last boring char
!                 while i >= p and str[i] in " \t\n":
                      i = i-1
!                 if i >= p:
                      lastch = str[i]
+                 p = newp
                  if p >= q:
                      break