Bug #229203 --> thunderbird needs new liness converted to commas when pasting into single cell text boxes.

This comes up when pasting address data from spreadsheet programs into the addressing widget. This pref cannot be turned on for seamonkey because it effects all single line text boxes.

r=glazman, moa=glazman
sr=bienvenu
This commit is contained in:
scott%scott-macgregor.org 2004-01-29 16:55:01 +00:00
Родитель 27a32d493e
Коммит daab80dc6d
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -543,10 +543,12 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
// 1. paste up to the first newline
// 2. replace newlines with spaces
// 3. strip newlines
// 4. replace with commas
// So find out what we're expected to do:
enum {
ePasteIntact = 0, ePasteFirstLine = 1,
eReplaceWithSpaces = 2, eStripNewlines = 3
eReplaceWithSpaces = 2, eStripNewlines = 3,
eReplaceWithCommas = 4
};
PRInt32 singleLineNewlineBehavior = 1;
nsCOMPtr<nsIPrefBranch> prefBranch =
@ -574,6 +576,11 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
if (firstCRLF > 0)
tString.Truncate(firstCRLF);
}
else if (singleLineNewlineBehavior == eReplaceWithCommas)
{
tString.Trim(CRLF, PR_TRUE, PR_TRUE);
tString.ReplaceChar(CRLF, ',');
}
else // even if we're pasting newlines, don't paste leading/trailing ones
tString.Trim(CRLF, PR_TRUE, PR_TRUE);