зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
210649f635
Коммит
e19997ed86
|
@ -543,10 +543,12 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||||
// 1. paste up to the first newline
|
// 1. paste up to the first newline
|
||||||
// 2. replace newlines with spaces
|
// 2. replace newlines with spaces
|
||||||
// 3. strip newlines
|
// 3. strip newlines
|
||||||
|
// 4. replace with commas
|
||||||
// So find out what we're expected to do:
|
// So find out what we're expected to do:
|
||||||
enum {
|
enum {
|
||||||
ePasteIntact = 0, ePasteFirstLine = 1,
|
ePasteIntact = 0, ePasteFirstLine = 1,
|
||||||
eReplaceWithSpaces = 2, eStripNewlines = 3
|
eReplaceWithSpaces = 2, eStripNewlines = 3,
|
||||||
|
eReplaceWithCommas = 4
|
||||||
};
|
};
|
||||||
PRInt32 singleLineNewlineBehavior = 1;
|
PRInt32 singleLineNewlineBehavior = 1;
|
||||||
nsCOMPtr<nsIPrefBranch> prefBranch =
|
nsCOMPtr<nsIPrefBranch> prefBranch =
|
||||||
|
@ -574,6 +576,11 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||||
if (firstCRLF > 0)
|
if (firstCRLF > 0)
|
||||||
tString.Truncate(firstCRLF);
|
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
|
else // even if we're pasting newlines, don't paste leading/trailing ones
|
||||||
tString.Trim(CRLF, PR_TRUE, PR_TRUE);
|
tString.Trim(CRLF, PR_TRUE, PR_TRUE);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче