]> granicus.if.org Git - python/commitdiff
Fix off-by-one error in Tim's recent change to comment_region(): the
authorGuido van Rossum <guido@python.org>
Thu, 10 Jun 1999 14:44:48 +0000 (14:44 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 10 Jun 1999 14:44:48 +0000 (14:44 +0000)
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

index 1bdb05be0d71071d591b7b1672cb4e02a78b5060..7784254a944a74122d27bcc50e6930320e686505 100644 (file)
@@ -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)