Commit 2b817872 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

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 195f84cfSigned-off-by: 's avatarHuw Davies <huw@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 9098d5b3
......@@ -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;
......
......@@ -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};
......
......@@ -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 &&
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment