From: Guido van Rossum Date: Thu, 10 Jun 1999 14:44:48 +0000 (+0000) Subject: Fix off-by-one error in Tim's recent change to comment_region(): the X-Git-Tag: v1.6a1~1251 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2571f2ce78189bdd35c3659c6fcbed584528813;p=thirdparty%2FPython%2Fcpython.git Fix off-by-one error in Tim's recent change to comment_region(): the list of lines returned by get_region() contains an empty line at the end representing the start of the next line, and this shouldn't be commented out! --- diff --git a/Tools/idle/AutoIndent.py b/Tools/idle/AutoIndent.py index 1bdb05be0d71..7784254a944a 100644 --- a/Tools/idle/AutoIndent.py +++ b/Tools/idle/AutoIndent.py @@ -347,7 +347,7 @@ class AutoIndent: def comment_region_event(self, event): head, tail, chars, lines = self.get_region() - for pos in range(len(lines)): + for pos in range(len(lines) - 1): line = lines[pos] lines[pos] = '##' + line self.set_region(head, tail, chars, lines)