diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 7b1a0b0..3d06611 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2012,6 +2012,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey) } else return TRUE; + ME_MoveCursorFromTableRowStartParagraph(editor); ME_UpdateSelectionLinkAttribute(editor); ME_UpdateRepaint(editor); ME_SendRequestResize(editor, FALSE); diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 6ec4c1f..cbebdba 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -304,6 +304,7 @@ void ME_CheckTablesForCorruption(ME_TextEditor *editor); void ME_ProtectPartialTableDeletion(ME_TextEditor *editor, int nOfs,int *nChars); ME_DisplayItem* ME_AppendTableRow(ME_TextEditor *editor, ME_DisplayItem *table_row); void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow); +void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor); struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor); void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef); diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c index 9cb4bbf..08846fe 100644 --- a/dlls/riched20/table.c +++ b/dlls/riched20/table.c @@ -588,6 +588,22 @@ void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow) ME_SendSelChange(editor); } +/* Make sure the cursor is not in the hidden table row start paragraph + * without a selection. */ +void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor) +{ + ME_DisplayItem *para = ME_GetParagraph(editor->pCursors[0].pRun); + if (para == ME_GetParagraph(editor->pCursors[1].pRun) && + para->member.para.nFlags & MEPF_ROWSTART) { + /* The cursors should not be at the hidden start row paragraph without + * a selection, so the cursor is moved into the first cell. */ + 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]; + } +} + struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) { RTFTable *tableDef = ALLOC_OBJ(RTFTable); diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c index 3ab39d0..8f3a22b 100644 --- a/dlls/riched20/undo.c +++ b/dlls/riched20/undo.c @@ -386,6 +386,7 @@ BOOL ME_Undo(ME_TextEditor *editor) { } while(p && p->type != diUndoEndTransaction); if (p) p->prev = NULL; + ME_MoveCursorFromTableRowStartParagraph(editor); ME_AddUndoItem(editor, diUndoEndTransaction, NULL); ME_CheckTablesForCorruption(editor); editor->nUndoStackSize--; @@ -422,6 +423,7 @@ BOOL ME_Redo(ME_TextEditor *editor) { } while(p && p->type != diUndoEndTransaction); if (p) p->prev = NULL; + ME_MoveCursorFromTableRowStartParagraph(editor); ME_AddUndoItem(editor, diUndoEndTransaction, NULL); ME_CheckTablesForCorruption(editor); editor->nUndoMode = nMode;