From e2571f2ce78189bdd35c3659c6fcbed584528813 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 10 Jun 1999 14:44:48 +0000 Subject: [PATCH] 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! --- Tools/idle/AutoIndent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/idle/AutoIndent.py b/Tools/idle/AutoIndent.py index 1bdb05be0d..7784254a94 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) -- 2.40.0