riched20: Return a paragraph ptr from the table insert helper.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-10-21 10:05:56 +01:00 committed by Alexandre Julliard
parent f0783863f9
commit 103cd9f2f2
1 changed files with 23 additions and 23 deletions

View File

@ -58,29 +58,27 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit_lists);
static const WCHAR cr_lf[] = {'\r', '\n', 0};
static ME_DisplayItem* ME_InsertEndParaFromCursor(ME_TextEditor *editor,
int nCursor,
const WCHAR *eol_str, int eol_len,
int paraFlags)
static ME_Paragraph* table_insert_end_para( ME_TextEditor *editor, ME_Cursor *cursor,
const WCHAR *eol_str, int eol_len, int para_flags )
{
ME_Style *pStyle = style_get_insert_style( editor, editor->pCursors + nCursor );
ME_Style *style = style_get_insert_style( editor, cursor );
ME_Paragraph *para;
ME_Cursor* cursor = &editor->pCursors[nCursor];
if (cursor->nOffset) run_split( editor, cursor );
para = para_split( editor, &cursor->pRun->member.run, pStyle, eol_str, eol_len, paraFlags );
ME_ReleaseStyle(pStyle);
para = para_split( editor, &cursor->pRun->member.run, style, eol_str, eol_len, para_flags );
ME_ReleaseStyle( style );
cursor->pPara = para_get_di( para );
cursor->pRun = run_get_di( para_first_run( para ) );
return para_get_di( para );
return para;
}
ME_DisplayItem* ME_InsertTableRowStartFromCursor(ME_TextEditor *editor)
{
ME_DisplayItem *para;
para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWSTART);
return para->member.para.prev_para;
ME_Paragraph *para;
para = table_insert_end_para( editor, editor->pCursors, cr_lf, 2, MEPF_ROWSTART );
return para_get_di( para_prev( para ) );
}
ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
@ -120,17 +118,19 @@ ME_DisplayItem* ME_InsertTableRowStartAtParagraph(ME_TextEditor *editor,
* Returns the first paragraph of the new cell. */
ME_DisplayItem* ME_InsertTableCellFromCursor(ME_TextEditor *editor)
{
ME_DisplayItem *para;
ME_Paragraph *para;
WCHAR tab = '\t';
para = ME_InsertEndParaFromCursor(editor, 0, &tab, 1, MEPF_CELL);
return para;
para = table_insert_end_para( editor, editor->pCursors, &tab, 1, MEPF_CELL );
return para_get_di( para );
}
ME_DisplayItem* ME_InsertTableRowEndFromCursor(ME_TextEditor *editor)
{
ME_DisplayItem *para;
para = ME_InsertEndParaFromCursor(editor, 0, cr_lf, 2, MEPF_ROWEND);
return para->member.para.prev_para;
ME_Paragraph *para;
para = table_insert_end_para( editor, editor->pCursors, cr_lf, 2, MEPF_ROWEND );
return para_get_di( para_prev( para ) );
}
ME_Paragraph* table_row_end( ME_Paragraph *para )