Specifically this means that if the final paragraph does not end in
a trailing \par, then new formatting is not applied to that paragraph.
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Rich text files have groupings of text, where styles are pushed onto
the stack when encountering a start of the group, then popped at the
end of the group. This was being handled improperly before, because a
single styleChanged flag was being stored to keep track of whether the
style needed to be restored at the end of a group. This fails to work
properly since the single flag isn't keeping track of all the levels
of the stack, so some styles are not restored properly.
When a colour table entry is empty, then the default colour is used.
For an incomplete colour table entry 0 is used for the missing colours.
Previously the -1 value used internally for missing colours was being
converted into white, where it should be using the default colour that
is normally black.
This bug could be seen by loading the following rich text into wordpad:
{\rtf{\colortbl;;}\cf1 text}
This was partially handled by ungetting the end group token (i.e. '}')
so that it was read again at the proper place. Unfortunately there is a
read hook that maintains a stackTop variable, which is decremented when
receiving this end group token. Therefore stackTop would get
decremented twice, and the rich text file would end prematurely.
This is fixed by incrementing the stackTop variable to compensate for it
being decremented twice.
Previously the control words in skipped groups were being processed by
the read hook on the RTF parser. By moving this code into the class
callbacks for the parser, the skipped groups actually remain skipped.
The check to see if the dwOutputBuffer is full was performed incorrectly
in RTFPutUnicodeString, however, this mistake was actually harmless
since it would just cause an extra loop that does nothing, then the
check would work properly with the variable fit equal to 0.
Checks were added for hexadecimal values that did not have valid
characters, and for EOF received before the final closing brace of the
rich text stream. The error values were tested on richedit versions 1,
2, 3 & 4.1, and they were all the same for these cases.
Document remaining uses of bEmulateVersion10 and other checks for CRLF in editor.c.
Make RTF reader emit a \r or a \r\n according to emulation, not a \n, which breaks streaming tests.
Remove todo_wine from a bunch of riched32 tests that now succeed.