diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 7b1a0b0..050fef1 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3700,7 +3700,15 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, } else if (!editor->bEmulateVersion10) { /* v4.1 */ if (para->member.para.nFlags & MEPF_ROWEND) { if (wstr=='\r') { - /* FIXME: Add a new table row after this row. */ + /* Add a new table row after this row. */ + para = ME_AppendTableRow(editor, para); + para = para->member.para.next_para; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + ME_CommitUndo(editor); + ME_CheckTablesForCorruption(editor); + ME_UpdateRepaint(editor); return 0; } else if (from == to) { para = para->member.para.next_para; diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c index dd745ff..517bf28 100644 --- a/dlls/riched20/para.c +++ b/dlls/riched20/para.c @@ -220,6 +220,13 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, new_para->member.para.pCell = run_para->member.para.pCell; assert(run_para->member.para.prev_para->member.para.nFlags & MEPF_CELL); assert(!(run_para->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART)); + if (new_para->member.para.pCell != new_para->member.para.next_para->member.para.pCell + && new_para->member.para.next_para->member.para.pCell + && !new_para->member.para.next_para->member.para.pCell->member.cell.prev_cell) + { + /* Row starts just after the row that was ended. */ + new_para->member.para.nFlags |= MEPF_ROWSTART; + } } else { new_para->member.para.pCell = run_para->member.para.pCell; } diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c index 9cb4bbf..456bcbc 100644 --- a/dlls/riched20/table.c +++ b/dlls/riched20/table.c @@ -227,7 +227,7 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor) } else if (!(p->member.para.nFlags & MEPF_ROWSTART)) { - assert(!(p->member.para.pFmt->wEffects & (PFE_TABLE|PFE_TABLEROWDELIMITER))); + assert(!(p->member.para.pFmt->wEffects & PFE_TABLEROWDELIMITER)); /* ROWSTART must be followed by a cell. */ assert(!(p->member.para.nFlags & MEPF_CELL)); /* ROWSTART must be followed by a cell. */ @@ -393,10 +393,7 @@ ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor, assert(table_row->type == diParagraph); if (!editor->bEmulateVersion10) { /* v4.1 */ ME_DisplayItem *insertedCell, *para, *cell; - if (table_row->member.para.nFlags & MEPF_ROWEND) - cell = ME_FindItemBack(table_row, diCell); - else - cell = ME_FindItemFwd(table_row, diCell); + cell = ME_FindItemFwd(ME_GetTableRowStart(table_row), diCell); run = ME_GetTableRowEnd(table_row)->member.para.next_para; run = ME_FindItemFwd(run, diRun); editor->pCursors[0].pRun = run;