Module: wine Branch: master Commit: 3ba419081a5413472aed0c6cdc1a79abf3ce9802 URL: https://source.winehq.org/git/wine.git/?a=commit;h=3ba419081a5413472aed0c6cd...
Author: Huw Davies huw@codeweavers.com Date: Thu Oct 29 10:49:14 2020 +0000
riched20: Use paragraph ptrs in the table move from row start function.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/riched20/editor.c | 2 +- dlls/riched20/editor.h | 2 +- dlls/riched20/table.c | 15 ++++++++------- dlls/riched20/undo.c | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 7687ec9d93e..797eb27b6b9 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2690,7 +2690,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey) } else return TRUE; - ME_MoveCursorFromTableRowStartParagraph(editor); + table_move_from_row_start( editor ); ME_UpdateSelectionLinkAttribute(editor); ME_UpdateRepaint(editor, FALSE); ME_SendRequestResize(editor, FALSE); diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index a49883c9861..b8916bc4ff3 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -302,6 +302,7 @@ ME_Paragraph *table_insert_cell( ME_TextEditor *editor, ME_Cursor *cursor ) DECL ME_Paragraph *table_insert_row_end( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN; ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor ) DECLSPEC_HIDDEN; ME_Paragraph *table_insert_row_start_at_para( ME_TextEditor *editor, ME_Paragraph *para ) DECLSPEC_HIDDEN; +void table_move_from_row_start( ME_TextEditor *editor ) DECLSPEC_HIDDEN; ME_Paragraph *table_outer_para( ME_Paragraph *para ) DECLSPEC_HIDDEN; void table_protect_partial_deletion( ME_TextEditor *editor, ME_Cursor *c, int *num_chars ) DECLSPEC_HIDDEN; ME_Paragraph *table_row_end( ME_Paragraph *para ) DECLSPEC_HIDDEN; @@ -309,7 +310,6 @@ ME_Cell *table_row_end_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN; ME_Cell *table_row_first_cell( ME_Paragraph *para ) DECLSPEC_HIDDEN; ME_Paragraph *table_row_start( ME_Paragraph *para ) DECLSPEC_HIDDEN; void ME_CheckTablesForCorruption(ME_TextEditor *editor) DECLSPEC_HIDDEN; -void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor) DECLSPEC_HIDDEN; struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef) DECLSPEC_HIDDEN; static inline ME_DisplayItem *cell_get_di(ME_Cell *cell) diff --git a/dlls/riched20/table.c b/dlls/riched20/table.c index 25c4e1820ce..c262d190b79 100644 --- a/dlls/riched20/table.c +++ b/dlls/riched20/table.c @@ -629,16 +629,17 @@ void table_handle_tab( ME_TextEditor *editor, BOOL selected_row )
/* Make sure the cursor is not in the hidden table row start paragraph * without a selection. */ -void ME_MoveCursorFromTableRowStartParagraph(ME_TextEditor *editor) +void table_move_from_row_start( ME_TextEditor *editor ) { - ME_DisplayItem *para = editor->pCursors[0].pPara; - if (para == editor->pCursors[1].pPara && - para->member.para.nFlags & MEPF_ROWSTART) { + ME_Paragraph *para = &editor->pCursors[0].pPara->member.para; + + if (para == &editor->pCursors[1].pPara->member.para && 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].pPara = para; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + para = para_next( para ); + editor->pCursors[0].pPara = para_get_di( para ); + editor->pCursors[0].pRun = run_get_di( para_first_run( para ) ); editor->pCursors[0].nOffset = 0; editor->pCursors[1] = editor->pCursors[0]; } diff --git a/dlls/riched20/undo.c b/dlls/riched20/undo.c index d9c5d28d6dc..fe0a4f721cd 100644 --- a/dlls/riched20/undo.c +++ b/dlls/riched20/undo.c @@ -438,7 +438,7 @@ BOOL ME_Undo(ME_TextEditor *editor) destroy_undo_item( undo ); }
- ME_MoveCursorFromTableRowStartParagraph(editor); + table_move_from_row_start( editor ); add_undo( editor, undo_end_transaction ); ME_CheckTablesForCorruption(editor); editor->nUndoStackSize--; @@ -475,7 +475,7 @@ BOOL ME_Redo(ME_TextEditor *editor) list_remove( &undo->entry ); destroy_undo_item( undo ); } - ME_MoveCursorFromTableRowStartParagraph(editor); + table_move_from_row_start( editor ); add_undo( editor, undo_end_transaction ); ME_CheckTablesForCorruption(editor); editor->nUndoMode = nMode;