SF bug #497839: reindent chokes on empty first lines.

Reindenter.run():  copy over initial all-whitespace lines (if any, and
after normalizing to remove trailing blanks and tabs).
Bugfix candidate.
This commit is contained in:
Tim Peters 2002-02-17 07:03:05 +00:00
parent 41d97d6777
commit 54e5b89d77
1 changed files with 4 additions and 0 deletions

View File

@ -157,6 +157,10 @@ class Reindenter:
have2want = {}
# Program after transformation.
after = self.after = []
# Copy over initial empty lines -- there's nothing to do until
# we see a line with *something* on it.
i = stats[0][0]
after.extend(lines[1:i])
for i in range(len(stats)-1):
thisstmt, thislevel = stats[i]
nextstmt = stats[i+1][0]