Skip to content

Commit 9d02d3a

Browse files
mtaran-googlemarijnh
authored andcommitted
[python mode] Return to parent indentation level when scope is closed.
This makes it work correctly when the hanging indent is different from the indent unit.
1 parent b1a256b commit 9d02d3a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mode/python/python.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,10 @@
320320
var closing = textAfter && textAfter.charAt(0) == scope.type;
321321
if (scope.align != null)
322322
return scope.align - (closing ? 1 : 0);
323+
else if (closing && state.scopes.length > 1)
324+
return state.scopes[state.scopes.length - 2].offset;
323325
else
324-
return scope.offset - (closing ? conf.indentUnit : 0);
326+
return scope.offset;
325327
},
326328

327329
lineComment: "#",

0 commit comments

Comments
 (0)