The first paragraph was being handled just by ME_StreamOutParaProps,
but subsequent paragraphs would check if the paragraph was starting or
ending a table. So I moved the code to check for tables into
ME_StreamOutParaProps.
This is a regression caused by commit
54b53b6018 which change the code to use
if statements instead of a switch, so the break statement should have
been changed to a continue statement.
ME_InsertTextFromCursor could previously follow the ME_CommitUndo call
leaving uncommitted changes which would cause improper grouping of commits,
or an assertion failure.
The call to ME_SendSelChange cannot be done in ME_CommitUndo like it was
before, because it must be done after wrapping. Native richedit controls
send EN_CHANGE first, which is sent in ME_UpdateRepaint, so
ME_SendSelChange must be before this notification in ME_UpdateRepaint.
Revert commit 049cf5aca0
richedit: Avoid notifying parent window in improper state.
The commit was meant to fix a problem caused by ME_SendSelChange being
called in ME_SendSelChange, but moving the calls to ME_CommitUndo caused
a regression. So this patch reverts the previous commit, and my
following patch will instead fix the bug by moving the call to
ME_SendSelChange out of ME_CommitUndo.
ME_CommitUndo and ME_CommitCoalescingUndo call ME_SendSelChange, which
may notify the parent window that the selection has changed, therefore
should generally be called after wrapping the text. Otherwise, the parent
window may send a message to the editor and cause an assertion failure.
The border widths documented by msdn are in points which are 72 dpi, which
is not equivalent to pixels (normally 96 dpi). I pre-converted all the
border widths to 96 dpi resolution since this avoids needed to store
fractions, and often avoids the need for convertion to the displays
resolution.
The existing tests were not properly testing the return value for the case
where all the text fits in the page rect, so this patch adds a couple of
simple tests for this case.
The parent window for the richedit control on creation is the one that
receives notify messages, even after the parent has been changed using
SetParent.
Using the ITextHost interface allows this notification to be received
for windowless richedit controls. Windowed richedit conrols have an
ITextHost implementation that will fill in hwndFrom and idFrom, but
these should probably be initialized to 0 for windowless richedit
controls.