--- a/EditTextView.st Sat Jan 16 10:40:59 2016 +0000
+++ b/EditTextView.st Tue Jan 19 07:05:36 2016 +0000
@@ -3637,32 +3637,36 @@
!
parenthizeSelectionWith:openingCharacter and:closingCharacter
- |newSelectionEnd|
+ |newSelectionEnd startLine endLine startCol endCol|
self hasSelection ifFalse:[^ self].
-
- newSelectionEnd := selectionEndCol.
-
- (self characterAtLine:selectionStartLine col:selectionStartCol) == openingCharacter ifTrue:[
- (self characterAtLine:selectionEndLine col:selectionEndCol) == closingCharacter ifTrue:[
- self deleteCharAtLine:selectionEndLine col:selectionEndCol.
+ startLine := selectionStartLine.
+ endLine := selectionEndLine.
+ startCol := selectionStartCol.
+ endCol := selectionEndCol.
+
+ newSelectionEnd := endCol.
+
+ (self characterAtLine:startLine col:startCol) == openingCharacter ifTrue:[
+ (self characterAtLine:endLine col:endCol) == closingCharacter ifTrue:[
+ self deleteCharAtLine:endLine col:endCol.
newSelectionEnd := newSelectionEnd-1.
].
- self deleteCharAtLine:selectionStartLine col:selectionStartCol.
- selectionStartLine == selectionEndLine ifTrue:[
+ self deleteCharAtLine:startLine col:startCol.
+ startLine == endLine ifTrue:[
newSelectionEnd := newSelectionEnd-1.
]
] ifFalse:[
- self insert:closingCharacter atLine:selectionEndLine col:selectionEndCol+1.
+ self insert:closingCharacter atLine:endLine col:endCol+1.
newSelectionEnd := newSelectionEnd+1.
- self insert:openingCharacter atLine:selectionStartLine col:selectionStartCol.
- selectionStartLine == selectionEndLine ifTrue:[
+ self insert:openingCharacter atLine:startLine col:startCol.
+ startLine == endLine ifTrue:[
newSelectionEnd := newSelectionEnd+1.
]
].
self
- selectFromLine:selectionStartLine col:selectionStartCol
- toLine:selectionEndLine col:newSelectionEnd.
+ selectFromLine:startLine col:startCol
+ toLine:endLine col:newSelectionEnd.
!
removeTrailingBlankLines