riched20: Pass a run ptr to the run joining function.
Signed-off-by: Huw Davies <huw@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4366c81f49
commit
3cade70f14
|
@ -131,7 +131,7 @@ int ME_CharFromPoint(ME_TextEditor *editor, int cx, ME_Run *run, BOOL closest, B
|
|||
int ME_PointFromCharContext(ME_Context *c, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN;
|
||||
int ME_PointFromChar(ME_TextEditor *editor, ME_Run *pRun, int nOffset, BOOL visual_order) DECLSPEC_HIDDEN;
|
||||
BOOL ME_CanJoinRuns(const ME_Run *run1, const ME_Run *run2) DECLSPEC_HIDDEN;
|
||||
void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p) DECLSPEC_HIDDEN;
|
||||
void run_join( ME_TextEditor *editor, ME_Run *run ) DECLSPEC_HIDDEN;
|
||||
ME_DisplayItem *ME_SplitRunSimple(ME_TextEditor *editor, ME_Cursor *cursor) DECLSPEC_HIDDEN;
|
||||
void ME_UpdateRunFlags(ME_TextEditor *editor, ME_Run *run) DECLSPEC_HIDDEN;
|
||||
SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run *run, int nLen,
|
||||
|
|
|
@ -237,31 +237,34 @@ void ME_RunOfsFromCharOfs(ME_TextEditor *editor,
|
|||
}
|
||||
|
||||
/******************************************************************************
|
||||
* ME_JoinRuns
|
||||
* run_join
|
||||
*
|
||||
* Merges two adjacent runs, the one given as a parameter and the next one.
|
||||
*/
|
||||
void ME_JoinRuns(ME_TextEditor *editor, ME_DisplayItem *p)
|
||||
void run_join( ME_TextEditor *editor, ME_Run *run )
|
||||
{
|
||||
ME_DisplayItem *pNext = p->next;
|
||||
ME_Run *next = run_next( run );
|
||||
int i;
|
||||
assert(p->type == diRun && pNext->type == diRun);
|
||||
assert(p->member.run.nCharOfs != -1);
|
||||
para_mark_rewrap( editor, &ME_GetParagraph( p )->member.para );
|
||||
|
||||
assert( run );
|
||||
assert( run->nCharOfs != -1 );
|
||||
para_mark_rewrap( editor, run->para );
|
||||
|
||||
/* Update all cursors so that they don't contain the soon deleted run */
|
||||
for (i=0; i<editor->nCursors; i++) {
|
||||
if (editor->pCursors[i].pRun == pNext) {
|
||||
editor->pCursors[i].pRun = p;
|
||||
editor->pCursors[i].nOffset += p->member.run.len;
|
||||
for (i = 0; i < editor->nCursors; i++)
|
||||
{
|
||||
if (&editor->pCursors[i].pRun->member.run == next)
|
||||
{
|
||||
editor->pCursors[i].pRun = run_get_di( run );
|
||||
editor->pCursors[i].nOffset += run->len;
|
||||
}
|
||||
}
|
||||
|
||||
p->member.run.len += pNext->member.run.len;
|
||||
ME_Remove(pNext);
|
||||
ME_DestroyDisplayItem(pNext);
|
||||
ME_UpdateRunFlags(editor, &p->member.run);
|
||||
ME_CheckCharOffsets(editor);
|
||||
run->len += next->len;
|
||||
ME_Remove( run_get_di( next ) );
|
||||
ME_DestroyDisplayItem( run_get_di( next ) );
|
||||
ME_UpdateRunFlags( editor, run );
|
||||
ME_CheckCharOffsets( editor );
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -714,7 +714,7 @@ static void ME_PrepareParagraphForWrapping( ME_TextEditor *editor, ME_Context *c
|
|||
if (p->type == diRun)
|
||||
{
|
||||
while (p->next->type == diRun && ME_CanJoinRuns( &p->member.run, &p->next->member.run ))
|
||||
ME_JoinRuns( c->editor, p );
|
||||
run_join( c->editor, &p->member.run );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue