Module: wine Branch: master Commit: 3cade70f14aeb12afef4ba53ec14eff3418abbd8 URL: https://source.winehq.org/git/wine.git/?a=commit;h=3cade70f14aeb12afef4ba53e...
Author: Huw Davies huw@codeweavers.com Date: Tue Oct 13 11:16:36 2020 +0100
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
---
dlls/riched20/editor.h | 2 +- dlls/riched20/run.c | 33 ++++++++++++++++++--------------- dlls/riched20/wrap.c | 2 +- 3 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index f61caa6478..de029f5bcb 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -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, diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c index c3bc7f50b3..eb5aeff050 100644 --- a/dlls/riched20/run.c +++ b/dlls/riched20/run.c @@ -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 ); }
/****************************************************************************** diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index c7b99f5ee2..fda1d99557 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -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 ); } } }