Dylan Smith : richedit: Enter at the end of a table row appends a new row.
Alexandre Julliard
julliard at winehq.org
Fri Sep 12 07:01:38 CDT 2008
Module: wine
Branch: master
Commit: 0843768919955de4e67da543343aa396664b6abc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0843768919955de4e67da543343aa396664b6abc
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Thu Sep 11 12:45:47 2008 -0400
richedit: Enter at the end of a table row appends a new row.
---
dlls/riched20/editor.c | 10 +++++++++-
dlls/riched20/para.c | 7 +++++++
dlls/riched20/table.c | 7 ++-----
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 3d06611..14c7256 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3701,7 +3701,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 08846fe..c4de61d 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;
More information about the wine-cvs
mailing list