Trailing whitespace is lost

RESOLVED FIXED

Status

()

RESOLVED FIXED
14 years ago
14 years ago

People

(Reporter: mrbkap, Assigned: mrbkap)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment, 1 obsolete attachment)

Whitespace at the end of a document is chopped of because nobody bothers
checking the scanner's mIncremental member and not returning kEOF if it's not
incremental (as all of the other tokens do).

Patch in a second.
Created attachment 184634 [details] [diff] [review]
patch v1

This checks if we're really at the end of the document, and if we are, doesn't
discard the trailing whitespace.
Attachment #184634 - Flags: superreview?(bzbarsky)
Attachment #184634 - Flags: review?(bzbarsky)
Status: NEW → ASSIGNED
Comment on attachment 184634 [details] [diff] [review]
patch v1

is haveCR guaranteed to have a non-bogus value even if nothing was consumed?
By the time we get to CWhitespaceToken::Consume(), we know that there is at
least one whitespace char in the scanner. Therefore, the Peek() in
nsScanner::ReadWhitespace() will succeed, and aHaveCR is set appropriately. I'll
change ReadWhitespace() to make sure to initialize aHaveCR in the second
iteration of this patch.
Attachment #184634 - Flags: superreview?(bzbarsky)
Attachment #184634 - Flags: review?(bzbarsky)
Created attachment 184700 [details] [diff] [review]
patch v2

As it turns out, nsScanner::ReadWhitespace(), *does* initialize its out
parameter. This patch also fixes CNewlineToken to not lose trailing newlines.
Attachment #184634 - Attachment is obsolete: true
Attachment #184700 - Flags: review?(rbs)
Comment on attachment 184700 [details] [diff] [review]
patch v2

r+sr=bzbarsky
Attachment #184700 - Flags: superreview+
Attachment #184700 - Flags: review?(rbs)
Attachment #184700 - Flags: review+
Comment on attachment 184700 [details] [diff] [review]
patch v2

This patch fixes a couple of problems with composer's Insert -> HTML, and also
prevents the loss of trailing whitespace/newlines.
Attachment #184700 - Flags: approval1.8b3?
Comment on attachment 184700 [details] [diff] [review]
patch v2

a=shaver
Attachment #184700 - Flags: approval1.8b3? → approval1.8b3+
Fix checked in.
Status: ASSIGNED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.