Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e2571f2

Browse files
committed
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!
1 parent a3b4a33 commit e2571f2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Tools/idle/AutoIndent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def dedent_region_event(self, event):
347347

348348
def comment_region_event(self, event):
349349
head, tail, chars, lines = self.get_region()
350-
for pos in range(len(lines)):
350+
for pos in range(len(lines) - 1):
351351
line = lines[pos]
352352
lines[pos] = '##' + line
353353
self.set_region(head, tail, chars, lines)

0 commit comments

Comments
 (0)