From e19997ed864d2a6071e2109d8d6c2f047a2fea02 Mon Sep 17 00:00:00 2001 From: "scott%scott-macgregor.org" Date: Thu, 29 Jan 2004 16:55:01 +0000 Subject: [PATCH] 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 --- editor/libeditor/text/nsTextEditRules.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/editor/libeditor/text/nsTextEditRules.cpp b/editor/libeditor/text/nsTextEditRules.cpp index ff8c11f012b..771920511a3 100644 --- a/editor/libeditor/text/nsTextEditRules.cpp +++ b/editor/libeditor/text/nsTextEditRules.cpp @@ -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 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);