Dylan Smith : richedit: Don't put cursor in the table row start paragraph.
Alexandre Julliard
julliard at winehq.org
Fri Sep 12 07:01:38 CDT 2008
Module: wine
Branch: master
Commit: 88a3a8a9c082cf85e20d3b036ae9fa31a5d3d3e5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=88a3a8a9c082cf85e20d3b036ae9fa31a5d3d3e5
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Thu Sep 11 12:45:36 2008 -0400
richedit: Don't put cursor in the table row start paragraph.
---
dlls/riched20/editor.c | 1 +
dlls/riched20/editor.h | 1 +
dlls/riched20/table.c | 16 ++++++++++++++++
dlls/riched20/undo.c | 2 ++
4 files changed, 20 insertions(+), 0 deletions(-)
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;
More information about the wine-cvs
mailing list