richedit: Don't put cursor in the table row start paragraph.

This commit is contained in:
Dylan Smith 2008-09-11 12:45:36 -04:00 committed by Alexandre Julliard
parent e4a0e0cc3f
commit 88a3a8a9c0
4 changed files with 20 additions and 0 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;