зеркало из https://github.com/mozilla/gecko-dev.git
Fix for bug 75498. Still need to translate line breaks :-( R=sfraser, SR=mscott
This commit is contained in:
Родитель
cc708addc2
Коммит
e58f44173f
|
@ -106,6 +106,36 @@ static nsresult RemoveDuplicateAddresses(const char * addresses, const char * an
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void TranslateLineEnding(nsString& data)
|
||||||
|
{
|
||||||
|
PRUnichar* rPtr; //Read pointer
|
||||||
|
PRUnichar* wPtr; //Write pointer
|
||||||
|
PRUnichar* sPtr; //Start data pointer
|
||||||
|
PRUnichar* ePtr; //End data pointer
|
||||||
|
|
||||||
|
rPtr = wPtr = sPtr = data.mUStr;
|
||||||
|
ePtr = rPtr + data.Length();
|
||||||
|
|
||||||
|
while (rPtr < ePtr)
|
||||||
|
{
|
||||||
|
if (*rPtr == 0x0D)
|
||||||
|
if (rPtr + 1 < ePtr && *(rPtr + 1) == 0x0A)
|
||||||
|
{
|
||||||
|
*wPtr = 0x0A;
|
||||||
|
rPtr ++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*wPtr = 0x0A;
|
||||||
|
else
|
||||||
|
*wPtr = *rPtr;
|
||||||
|
|
||||||
|
rPtr ++;
|
||||||
|
wPtr ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.SetLength(wPtr - sPtr);
|
||||||
|
}
|
||||||
|
|
||||||
nsMsgCompose::nsMsgCompose()
|
nsMsgCompose::nsMsgCompose()
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
@ -219,6 +249,10 @@ nsresult nsMsgCompose::ConvertAndLoadComposeWindow(nsIEditorShell *aEditorShell,
|
||||||
nsCOMPtr<nsIEditor> editor;
|
nsCOMPtr<nsIEditor> editor;
|
||||||
nsCOMPtr<nsIDOMNode> nodeInserted;
|
nsCOMPtr<nsIDOMNode> nodeInserted;
|
||||||
|
|
||||||
|
TranslateLineEnding(aPrefix);
|
||||||
|
TranslateLineEnding(aBuf);
|
||||||
|
TranslateLineEnding(aSignature);
|
||||||
|
|
||||||
aEditorShell->GetEditor(getter_AddRefs(editor));
|
aEditorShell->GetEditor(getter_AddRefs(editor));
|
||||||
|
|
||||||
if (editor)
|
if (editor)
|
||||||
|
@ -3126,6 +3160,8 @@ nsresult nsMsgCompose::SetSignature(nsIMsgIdentity *identity)
|
||||||
|
|
||||||
if (!aSignature.IsEmpty())
|
if (!aSignature.IsEmpty())
|
||||||
{
|
{
|
||||||
|
TranslateLineEnding(aSignature);
|
||||||
|
|
||||||
editor->BeginTransaction();
|
editor->BeginTransaction();
|
||||||
editor->EndOfDocument();
|
editor->EndOfDocument();
|
||||||
if (m_composeHTML)
|
if (m_composeHTML)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче