Skip to content

Commit 199a6bc

Browse files
committed
Fixes bpython#143 make auto-dedent smarter
1 parent 9c6a895 commit 199a6bc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bpython/repl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,6 +1021,9 @@ def next_indentation(line, tab_length):
10211021
indentation = (len(line) - len(line.lstrip(' '))) // tab_length
10221022
if line.rstrip().endswith(':'):
10231023
indentation += 1
1024+
elif indentation >= 1:
1025+
if line.lstrip().startswith(('return', 'pass')):
1026+
indentation -= 1
10241027
return indentation
10251028

10261029

0 commit comments

Comments
 (0)