--- a/EditTextView.st Sun Jul 07 15:01:35 2019 +0200
+++ b/EditTextView.st Sun Jul 07 15:14:41 2019 +0200
@@ -6049,7 +6049,7 @@
handleReturnPressed
"return key pressed - handle autoIndent"
- |i leftPart rightPart oldIndent newIndent language
+ |i leftPart rightPart startIndent oldIndent newIndent language
bracketStrings endsWithOpeningBracket startsWithClosingBracket|
self isReadOnly ifTrue:[
@@ -6078,6 +6078,8 @@
self copyAndDeleteSelection.
].
+ startIndent := self leftIndentOfLine:cursorLine.
+
"/ split the line
leftPart := ((self listAt:cursorLine to:cursorCol-1) ? '') string.
rightPart := ((self listAt:cursorLine from:cursorCol) ? '') string.
@@ -6119,6 +6121,12 @@
] ifFalse:[
(endsWithOpeningBracket value:leftPart) ifTrue:[
newIndent := i.
+ (startsWithClosingBracket value:rightPart) ifTrue:[
+ "/ entered return inside [] - insert another empty line
+ self insertCharAtCursor:(Character cr).
+ self indentFromLine:cursorLine toLine:cursorLine by:startIndent.
+ self cursorUp.
+ ]
] ifFalse:[
(startsWithClosingBracket value:rightPart) ifTrue:[
leftPart notEmptyOrNil ifTrue:[