OSDN Git Service
XML Comment Formatting Fixes. DO NOT MERGE.
This changeset fixes issue 20452 related to XML comment
handling. There are several changes.
First it fixes a truncation bug where the last character in a comment
could get erased.
Second it makes sure we don't end up with double blank lines, since
there were cases where the comment formatter would insert a newline
(to preserve newlines after comments in the original document) and a
subsequent element or close tag would also insert a newline (which is
where the normal blank lines are added). Now the code will peek at the
write buffer to make sure we haven't already added a blank line.
Third, it attempts to handle multiline comments a bit better such that
the code which preserves indentation of the first comment line will
dedent down to the minimum indentation level of the block comment.
This means that we will format
<!-- First
Second -->
into
<!--
First
Second
-->
instead of
<!--
First
Second
-->
as the code did up until now. (The current handling was there to make
<!-- This is
a comment -->
format into
<!--
This is
a comment
-->
)
Unit tests.
Change-Id: I7201b55a2c824c3c0b43287e853bc9b75d74ed7f