Skip to content

Commit 48f508c

Browse files
Unindent after 'pass'.
1 parent ae21ebd commit 48f508c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ptpython/key_bindings.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,13 @@ def auto_newline(buffer):
215215
current_line = buffer.document.current_line_before_cursor.rstrip()
216216
insert_text('\n')
217217

218+
# Unident if the last line ends with 'pass', remove four spaces.
219+
unindent = current_line.rstrip().endswith(' pass')
220+
218221
# Copy whitespace from current line
219-
for c in current_line:
222+
current_line2 = current_line[4:] if unindent else current_line
223+
224+
for c in current_line2:
220225
if c.isspace():
221226
insert_text(c)
222227
else:

0 commit comments

Comments
 (0)