riched20: Start re-wrap loop at the beginning of any table.

This ensures that cell heights of cells before the first marked
cell are correctly adjusted.

Fixes last part of a regression caused by commit
195f84cfa1

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-10-20 12:50:37 +01:00 committed by Alexandre Julliard
parent 9098d5b300
commit 2b817872cb
3 changed files with 19 additions and 3 deletions

View File

@ -207,6 +207,7 @@ int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void para_destroy( ME_TextEditor *editor, ME_Paragraph *item ) DECLSPEC_HIDDEN;
ME_Run *para_end_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Run *para_first_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
BOOL para_in_table( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt ) DECLSPEC_HIDDEN;
void para_mark_add( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;
void para_mark_remove( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN;

View File

@ -119,6 +119,11 @@ ME_Run *para_end_run( ME_Paragraph *para )
return para->eop_run;
}
BOOL para_in_table( ME_Paragraph *para )
{
return para->fmt.wEffects & PFE_TABLE;
}
void ME_MakeFirstParagraph(ME_TextEditor *editor)
{
static const WCHAR cr_lf[] = {'\r','\n',0};

View File

@ -1026,7 +1026,7 @@ static void adjust_para_y( ME_Paragraph *para, ME_Context *c, struct repaint_ran
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
{
ME_Paragraph *para, *next;
struct wine_rb_entry *entry, *next_entry;
struct wine_rb_entry *entry, *next_entry = NULL;
ME_Context c;
int totalWidth = editor->nTotalWidth, prev_width;
struct repaint_range repaint = { NULL, NULL };
@ -1039,7 +1039,16 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
while (entry)
{
para = WINE_RB_ENTRY_VALUE( entry, ME_Paragraph, marked_entry );
next_entry = wine_rb_next( entry );
/* If the first entry lies inside a table, go back to the start
of the table to ensure cell heights are kept in sync. */
if (!next_entry && para_in_table( para ) && para != table_outer_para( para ))
{
para = table_outer_para( para );
next_entry = entry;
}
else
next_entry = wine_rb_next( entry );
c.pt = para->pt;
prev_width = para->nWidth;
@ -1054,7 +1063,8 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
if (para_next( para ))
{
if (c.pt.x != para_next( para )->pt.x || c.pt.y != para_next( para )->pt.y)
if (c.pt.x != para_next( para )->pt.x || c.pt.y != para_next( para )->pt.y ||
para_in_table( para ))
{
next = para;
while (para_next( next ) && &next->marked_entry != next_entry &&