--- a/EditTextView.st Thu May 01 10:47:38 2014 +0100
+++ b/EditTextView.st Wed Jun 04 22:40:15 2014 +0100
@@ -4337,7 +4337,7 @@
basicReplace:aCharacter atLine:lineNr col:colNr
"replace a single character at lineNr/colNr"
- |line lineSize newLine drawCharacterOnly|
+ |line lineSize newLineSpecies newLine drawCharacterOnly|
self checkModificationsAllowed ifFalse:[ ^ self].
@@ -4359,12 +4359,13 @@
(lineSize == 0) ifTrue:[
newLine := aCharacter asString species new:colNr.
] ifFalse: [
- (colNr > lineSize) ifTrue: [
- newLine := line species new:colNr.
- newLine replaceFrom:1 to:lineSize with:line startingAt:1.
- ] ifFalse: [
- newLine := line copy.
- ]
+ (aCharacter bitsPerCharacter > line bitsPerCharacter) ifTrue:[
+ newLineSpecies := aCharacter stringSpecies
+ ] ifFalse:[
+ newLineSpecies := line species
+ ].
+ newLine := newLineSpecies new:(colNr max:lineSize).
+ newLine replaceFrom:1 to:lineSize with:line startingAt:1.
].
newLine at:colNr put:aCharacter.
aCharacter == (Character tab) ifTrue:[
@@ -4397,7 +4398,7 @@
This is not prepared to encounter special chars (except TAB)
in the string."
- |line lineSize newLine endCol|
+ |line lineSize newLine newLineSpecies endCol|
self checkModificationsAllowed ifFalse:[ ^ self].
@@ -4409,21 +4410,14 @@
(lineSize == 0) ifTrue:[
newLine := aString species new:endCol.
] ifFalse: [
- (endCol > lineSize) ifTrue: [
- aString isText ifTrue:[
- newLine := aString species new:endCol.
- ] ifFalse:[
- newLine := line species new:endCol.
- ].
- newLine replaceFrom:1 to:lineSize with:line startingAt:1.
- ] ifFalse: [
- aString isText ifTrue:[
- newLine := aString species new:line size.
- newLine replaceFrom:1 to:lineSize with:line startingAt:1.
- ] ifFalse:[
- newLine := line copy.
- ]
- ]
+ (aString isText or:[aString bitsPerCharacter > line bitsPerCharacter]) ifTrue:[
+ newLineSpecies := aString stringSpecies
+ ] ifFalse:[
+ newLineSpecies := line species
+ ].
+
+ newLine := newLineSpecies new:(endCol max:lineSize).
+ newLine replaceFrom:1 to:lineSize with:line startingAt:1.
].
newLine replaceFrom:colNr with:aString.
(aString includes:(Character tab)) ifTrue:[
@@ -8833,11 +8827,11 @@
!EditTextView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.604 2014-04-12 11:36:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.605 2014-05-30 21:20:49 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.604 2014-04-12 11:36:34 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.605 2014-05-30 21:20:49 cg Exp $'
!
version_HG