Commit 00824a03 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Pass a paragraph ptr to the paragraph destruction function.

parent fd4b700a
...@@ -3213,10 +3213,11 @@ void ME_DestroyEditor(ME_TextEditor *editor) ...@@ -3213,10 +3213,11 @@ void ME_DestroyEditor(ME_TextEditor *editor)
ME_ClearTempStyle(editor); ME_ClearTempStyle(editor);
ME_EmptyUndoStack(editor); ME_EmptyUndoStack(editor);
editor->pBuffer->pFirst = NULL; editor->pBuffer->pFirst = NULL;
while(p) { while(p)
{
pNext = p->next; pNext = p->next;
if (p->type == diParagraph) if (p->type == diParagraph)
destroy_para(editor, p); para_destroy( editor, &p->member.para );
else else
ME_DestroyDisplayItem(p); ME_DestroyDisplayItem(p);
p = pNext; p = pNext;
......
...@@ -75,7 +75,6 @@ ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass ...@@ -75,7 +75,6 @@ ME_DisplayItem *ME_FindItemBackOrHere(ME_DisplayItem *di, ME_DIType nTypeOrClass
ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN; ME_DisplayItem *ME_MakeDI(ME_DIType type) DECLSPEC_HIDDEN;
void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN; void ME_DestroyDisplayItem(ME_DisplayItem *item) DECLSPEC_HIDDEN;
void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN; void ME_DumpDocument(ME_TextBuffer *buffer) DECLSPEC_HIDDEN;
void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) DECLSPEC_HIDDEN;
/* string.c */ /* string.c */
ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN; ME_String *ME_MakeStringN(LPCWSTR szText, int nMaxChars) DECLSPEC_HIDDEN;
...@@ -205,6 +204,7 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPE ...@@ -205,6 +204,7 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPE
void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN; void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN; void ME_SetDefaultParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN; int get_total_width(ME_TextEditor *editor) DECLSPEC_HIDDEN;
void para_destroy( ME_TextEditor *editor, ME_Paragraph *item ) DECLSPEC_HIDDEN;
ME_Run *para_end_run( ME_Paragraph *para ) DECLSPEC_HIDDEN; ME_Run *para_end_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Run *para_first_run( ME_Paragraph *para ) DECLSPEC_HIDDEN; ME_Run *para_first_run( ME_Paragraph *para ) DECLSPEC_HIDDEN;
ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt ) DECLSPEC_HIDDEN; ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_first_fmt ) DECLSPEC_HIDDEN;
......
...@@ -39,20 +39,18 @@ static ME_Paragraph *para_create( ME_TextEditor *editor ) ...@@ -39,20 +39,18 @@ static ME_Paragraph *para_create( ME_TextEditor *editor )
return &item->member.para; return &item->member.para;
} }
void destroy_para(ME_TextEditor *editor, ME_DisplayItem *item) void para_destroy( ME_TextEditor *editor, ME_Paragraph *para )
{ {
assert(item->type == diParagraph); if (para->nWidth == editor->nTotalWidth)
if (item->member.para.nWidth == editor->nTotalWidth)
{ {
item->member.para.nWidth = 0; para->nWidth = 0;
editor->nTotalWidth = get_total_width(editor); editor->nTotalWidth = get_total_width(editor);
} }
editor->total_rows -= item->member.para.nRows; editor->total_rows -= para->nRows;
ME_DestroyString(item->member.para.text); ME_DestroyString( para->text );
para_num_clear( &item->member.para.para_num ); para_num_clear( &para->para_num );
para_mark_remove( editor, &item->member.para ); para_mark_remove( editor, para );
ME_DestroyDisplayItem(item); ME_DestroyDisplayItem( para_get_di( para ) );
} }
/* Note para_next/prev will return the start and end doc nodes */ /* Note para_next/prev will return the start and end doc nodes */
...@@ -762,7 +760,7 @@ ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_fir ...@@ -762,7 +760,7 @@ ME_Paragraph *para_join( ME_TextEditor *editor, ME_Paragraph *para, BOOL use_fir
para->next_para = next->next_para; para->next_para = next->next_para;
next->next_para->member.para.prev_para = para_get_di( para ); next->next_para->member.para.prev_para = para_get_di( para );
ME_Remove( para_get_di(next) ); ME_Remove( para_get_di(next) );
destroy_para( editor, para_get_di( next ) ); para_destroy( editor, next );
ME_PropagateCharOffset( para->next_para, -end_len ); ME_PropagateCharOffset( para->next_para, -end_len );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment