riched20: Use ME_Paragraph ptrs in InternalDeleteText().

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-12 13:09:09 +01:00 committed by Alexandre Julliard
parent f648eff162
commit a6d41a0391
1 changed files with 9 additions and 9 deletions

View File

@ -308,13 +308,13 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
int nOfs = ME_GetCursorOfs(start), text_len = ME_GetTextLength( editor ); int nOfs = ME_GetCursorOfs(start), text_len = ME_GetTextLength( editor );
int shift = 0; int shift = 0;
int totalChars = nChars; int totalChars = nChars;
ME_DisplayItem *start_para; ME_Paragraph *start_para;
BOOL delete_all = FALSE; BOOL delete_all = FALSE;
/* Prevent deletion past last end of paragraph run. */ /* Prevent deletion past last end of paragraph run. */
nChars = min(nChars, text_len - nOfs); nChars = min(nChars, text_len - nOfs);
if (nChars == text_len) delete_all = TRUE; if (nChars == text_len) delete_all = TRUE;
start_para = c.pPara; start_para = &c.pPara->member.para;
if (!bForce) if (!bForce)
{ {
@ -349,19 +349,19 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
run->nCharOfs); run->nCharOfs);
if (!editor->bEmulateVersion10) /* v4.1 */ if (!editor->bEmulateVersion10) /* v4.1 */
{ {
ME_DisplayItem *next_para = ME_FindItemFwd(c.pRun, diParagraphOrEnd); ME_Paragraph *this_para = run->para;
ME_DisplayItem *this_para = next_para->member.para.prev_para; ME_Paragraph *next_para = para_next( this_para );
/* The end of paragraph before a table row is only deleted if there /* The end of paragraph before a table row is only deleted if there
* is nothing else on the line before it. */ * is nothing else on the line before it. */
if (this_para == start_para && if (this_para == start_para && next_para->nFlags & MEPF_ROWSTART)
next_para->member.para.nFlags & MEPF_ROWSTART)
{ {
/* If the paragraph will be empty, then it should be deleted, however /* If the paragraph will be empty, then it should be deleted, however
* it still might have text right now which would inherit the * it still might have text right now which would inherit the
* MEPF_STARTROW property if we joined it right now. * MEPF_STARTROW property if we joined it right now.
* Instead we will delete it after the preceding text is deleted. */ * Instead we will delete it after the preceding text is deleted. */
if (nOfs > this_para->member.para.nCharOfs) { if (nOfs > this_para->nCharOfs)
{
/* Skip this end of line. */ /* Skip this end of line. */
nChars -= (eollen < nChars) ? eollen : nChars; nChars -= (eollen < nChars) ? eollen : nChars;
continue; continue;
@ -383,7 +383,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
c.nOffset -= nCharsToDelete; c.nOffset -= nCharsToDelete;
para_mark_rewrap( editor, &ME_FindItemBack( c.pRun, diParagraph )->member.para ); para_mark_rewrap( editor, c.pRun->member.run.para );
cursor = c; cursor = c;
/* nChars is the number of characters that should be deleted from the /* nChars is the number of characters that should be deleted from the
@ -447,7 +447,7 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, ME_Cursor *start,
continue; continue;
} }
} }
if (delete_all) ME_SetDefaultParaFormat( editor, &start_para->member.para.fmt ); if (delete_all) ME_SetDefaultParaFormat( editor, &start_para->fmt );
return TRUE; return TRUE;
} }