changed indent on return
@@ -388,15 +388,17 @@ class BackingTextBuffer(Mutator):
self.redo()
self.cursorMove(1, -self.cursorCol, -self.goalCol)
self.redo()
- app.log.debug('carriageReturn d')
if 1: # todo: if indent on CR
line = self.lines[self.cursorRow-1]
commonIndent = 2
indent = 0
while indent < len(line) and line[indent] == ' ':
indent += 1
- if len(line) and line[-1] == ':':
+ if len(line):
+ if line[-1] in [':', '[', '{']:
indent += commonIndent
+ elif line.count('(') > line.count(')'):
+ indent += commonIndent * 2
if indent:
self.redoAddChange(('i', ' '*indent));
self.redo()
