Commit 08437689 authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

richedit: Enter at the end of a table row appends a new row.

parent 88a3a8a9
...@@ -3701,7 +3701,15 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -3701,7 +3701,15 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
} else if (!editor->bEmulateVersion10) { /* v4.1 */ } else if (!editor->bEmulateVersion10) { /* v4.1 */
if (para->member.para.nFlags & MEPF_ROWEND) { if (para->member.para.nFlags & MEPF_ROWEND) {
if (wstr=='\r') { 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; return 0;
} else if (from == to) { } else if (from == to) {
para = para->member.para.next_para; para = para->member.para.next_para;
......
...@@ -220,6 +220,13 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run, ...@@ -220,6 +220,13 @@ ME_DisplayItem *ME_SplitParagraph(ME_TextEditor *editor, ME_DisplayItem *run,
new_para->member.para.pCell = run_para->member.para.pCell; 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_CELL);
assert(!(run_para->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART)); 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 { } else {
new_para->member.para.pCell = run_para->member.para.pCell; new_para->member.para.pCell = run_para->member.para.pCell;
} }
......
...@@ -227,7 +227,7 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor) ...@@ -227,7 +227,7 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor)
} }
else if (!(p->member.para.nFlags & MEPF_ROWSTART)) 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. */ /* ROWSTART must be followed by a cell. */
assert(!(p->member.para.nFlags & MEPF_CELL)); assert(!(p->member.para.nFlags & MEPF_CELL));
/* ROWSTART must be followed by a cell. */ /* ROWSTART must be followed by a cell. */
...@@ -393,10 +393,7 @@ ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor, ...@@ -393,10 +393,7 @@ ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor,
assert(table_row->type == diParagraph); assert(table_row->type == diParagraph);
if (!editor->bEmulateVersion10) { /* v4.1 */ if (!editor->bEmulateVersion10) { /* v4.1 */
ME_DisplayItem *insertedCell, *para, *cell; ME_DisplayItem *insertedCell, *para, *cell;
if (table_row->member.para.nFlags & MEPF_ROWEND) cell = ME_FindItemFwd(ME_GetTableRowStart(table_row), diCell);
cell = ME_FindItemBack(table_row, diCell);
else
cell = ME_FindItemFwd(table_row, diCell);
run = ME_GetTableRowEnd(table_row)->member.para.next_para; run = ME_GetTableRowEnd(table_row)->member.para.next_para;
run = ME_FindItemFwd(run, diRun); run = ME_FindItemFwd(run, diRun);
editor->pCursors[0].pRun = run; editor->pCursors[0].pRun = run;
......
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