Bug 1328093 - HTMLEditor::InsertTextWithQuotations() should include the first line break into the <span> it creates. r=masayuki
authorJorg K <jorgk@jorgk.com>
Tue, 10 Jan 2017 01:50:00 -0500
changeset 328829 5001b49ef3f6083e770fb23749a629a0c9b0d825
parent 328828 ae3ed8b79fa70f533a2dc639888b8484b04f8364
child 328830 0673be23886e7eadfa5d815394357db365b86f70
push id85550
push userryanvm@gmail.com
push dateWed, 11 Jan 2017 03:54:43 +0000
treeherdermozilla-inbound@5001b49ef3f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1328093
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1328093 - HTMLEditor::InsertTextWithQuotations() should include the first line break into the <span> it creates. r=masayuki
editor/libeditor/HTMLEditorDataTransfer.cpp
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -1770,16 +1770,23 @@ HTMLEditor::InsertTextWithQuotations(con
       // But if the current hunk is quoted, then we want to make sure
       // that any extra newlines on the end do not get included in
       // the quoted section: blank lines flaking a quoted section
       // should be considered unquoted, so that if the user clicks
       // there and starts typing, the new text will be outside of
       // the quoted block.
       if (curHunkIsQuoted) {
         lineStart = firstNewline;
+
+        // 'firstNewline' points to the first '\n'. We want to
+        // ensure that this first newline goes into the hunk
+        // since quoted hunks can be displayed as blocks
+        // (and the newline should become invisible in this case).
+        // So the next line needs to start at the next character.
+        lineStart++;
       }
     }
 
     // If no newline found, lineStart is now strEnd and we can finish up,
     // inserting from curHunk to lineStart then returning.
     const nsAString &curHunk = Substring(hunkStart, lineStart);
     nsCOMPtr<nsIDOMNode> dummyNode;
     if (curHunkIsQuoted) {