--- a/SmallSense__SmalltalkEditSupport.st Mon Nov 04 13:48:49 2013 -0300
+++ b/SmallSense__SmalltalkEditSupport.st Tue Nov 19 12:48:26 2013 +0000
@@ -204,7 +204,7 @@
!
keyPressReturn
- | line tokens i t |
+ | line tokens i t currentLineIndent |
line := textView listAt: textView cursorLine.
line isNil ifTrue:[ ^ false ].
@@ -213,15 +213,12 @@
(line indexOfAny:'[|/') == 0 ifTrue:[ ^ false ].
"/ Insert "/ at the beggining of the line if current line starts with "/
- i := line indexOfNonSeparator.
+ i := currentLineIndent := line indexOfNonSeparator.
(i ~~ 0 and:[ i < line size and:[(line at:i) == $" and:[(line at:i + 1) == $/]]]) ifTrue:[
- "/ OK, current line contains eol-comment
- self insertDo:[
- textView insertCharAtCursor: Character cr.
- ].
- self insertDo:[
- textView insertStringAtCursor: '"/ '
- ].
+ "/ OK, current line contains eol-comment. Split into
+ "/ two actions so backspace deletes only the inserted '"/ ' text
+ self insertElectric: #('' '') advanceCursorBy: (1 @ i).
+ self insertElectric: '"/ '.
^ true
].
@@ -253,9 +250,7 @@
[ i > 0 and:[ (tokens at: i) == #Identifier ] ] whileTrue:[ i := i - 1 ].
(i ~~ 0 and: [(tokens at: i) == $|]) ifTrue:[
RBFormatter emptyLineAfterTemporaries ifTrue:[
- textView undoableDo:[
- textView insertStringAtCursor: (Character cr asString , Character cr , Character cr)
- ].
+ self insertElectric:#('' '' '') advanceCursorBy: 2 @ currentLineIndent.
^ true
]
]
@@ -263,7 +258,7 @@
^ false.
"Created: / 25-07-2013 / 00:02:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 04-10-2013 / 08:03:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 19-11-2013 / 12:41:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
keyPressReturnToken