--- a/textrendering/texthandling/stext/TXTETEXT.CPP Mon May 03 14:13:26 2010 +0300
+++ b/textrendering/texthandling/stext/TXTETEXT.CPP Fri May 14 17:40:32 2010 +0300
@@ -1101,8 +1101,6 @@
{return ((iByteStore->Size()/sizeof(TText))-1);}
-
-
EXPORT_C void CPlainText::InsertL(TInt aInsertPos,const TChar& aChar)
/** Inserts either a single character or a descriptor into the text object
at a specified document position.
@@ -1117,11 +1115,28 @@
__TEST_INVARIANT;
__ASSERT_ALWAYS(aInsertPos>=0 && aInsertPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
- TBuf<1> content;
- content.Append(aChar);
- DoPtInsertL(aInsertPos,content);
+ TInt contentLength = 1;
+ if (aChar < 0x10000)
+ {
+ TBuf<1> content;
+ content.Append(aChar);
+ DoPtInsertL(aInsertPos,content);
+ }
+ else
+ {
+ TText16 high = TChar::GetHighSurrogate(aChar);
+ TText16 low = TChar::GetLowSurrogate(aChar);
+ RDebug::Print(_L("CPlainText::InsertL(%d), %X expand to %X %X."), aInsertPos, aChar, high, low);
+
+ TBuf<2> content;
+ contentLength = 2;
+ content.Append(high);
+ content.Append(low);
+ DoPtInsertL(aInsertPos,content);
+ }
if (FieldSetPresent())
- iFieldSet->NotifyInsertion(aInsertPos,content.Length()); // length always 1 - optimise???
+ iFieldSet->NotifyInsertion(aInsertPos,contentLength);
+
SetHasChanged(ETrue);
__TEST_INVARIANT;